Skip to content

Instantly share code, notes, and snippets.

@interchen
Created May 28, 2014 06:07
Show Gist options
  • Save interchen/2fe74063739207ff8a02 to your computer and use it in GitHub Desktop.
Save interchen/2fe74063739207ff8a02 to your computer and use it in GitHub Desktop.
Header
// 调试中文
#define Debug_Language_Chinese 0
// 调试英文
#define Debug_Language_English 0
#define AppLanguage @"appLanguage"
#define AppLanguage_ZH_CN @"zh-Hans"
#define AppLanguage_EN_US @"en"
#if Debug_Language_Chinese
#define CustomLocalizedString(key, comment) \
[[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:AppLanguage_ZH_CN ofType:@"lproj"]] localizedStringForKey:(key) value:@"" table:nil]
#elif Debug_Language_English
#define CustomLocalizedString(key, comment) \
[[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:AppLanguage_EN_US ofType:@"lproj"]] localizedStringForKey:(key) value:@"" table:nil]
#else
#define CustomLocalizedString(key, comment) \
[[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:AppLanguage]] ofType:@"lproj"]] localizedStringForKey:(key) value:@"" table:nil]
#endif
/**
* 是否是 iPad,Yes is iPad, NO is iPhone
*/
#define isiPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
#define isBeforeiOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0)
#define isAfteriOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment