// AppConfig.h
創建一個.h文件作爲全局設置
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#define DARK_BACKGROUND [UIColor colorWithPatternImage:[UIImage imageNamed:@"tableview"]]
#define LIGHT_BACKGROUND [UIColor colorWithRed:250.0/255.0 green:250.0/255.0 blue:250.0/255.0 alpha:1.0]
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
//新浪微博設置
#define kSinaAppKey @"3835906094"
#define kSinaAppSecret @"f7efce5aec66546a192a55dc4ff0ca58"
#define kSinaAppRedirectURI @"http://sns.whalecloud.com/sina2/callback"
#define kSinaSSoCallbackScheme @"sinaweibosso.3835906094"
//騰訊微博設置
#define kQQAppKey @"3835906094"
#define kQQAppSecret @"f7efce5aec66546a192a55dc4ff0ca58"
#define kQQAppRedirectURI @"http://sns.whalecloud.com/sina2/callback"
//全局應用
#define MyApp ((AppDelegate*)[[UIApplication sharedApplication] delegate])
//友盟統計 -- 用戶
#define UMENG_APPKEY @"51b43bdf56240b6ef4009a3d"
//推廣渠道ID
#define APP_CHANNELID @"AppStore"
//AppStore, 91, Weiphone
//AppKey
//微信AppID:wx959223c1aec3c4aa
#define WEIXIN_APPID @"wx959223c1aec3c4aa"
//判斷是否爲iPhone5
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
//判斷是否爲iOS7
#define iOS7 ((floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1))
//判斷是否爲iPad
static BOOL isDeviceIPad() {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return YES;
}
#endif
return NO;
}
//文本對齊方式
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
#define TextAlignmentCenter NSTextAlignmentCenter
#define TextAlignmentLeft NSTextAlignmentLeft
#define TextAlignmentRight NSTextAlignmentRight
#else
#define TextAlignmentCenter UITextAlignmentCenter
#define TextAlignmentLeft UITextAlignmentLeft
#define TextAlignmentRight UITextAlignmentRight
#endif
//文本截取方式
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
#define LineBreakModeWordWrap NSLineBreakByWordWrapping
#define LineBreakModeCharacterWrap NSLineBreakByCharWrapping
#define LineBreakModeClip NSLineBreakByClipping
#define LineBreakModeHeadTruncation NSLineBreakByTruncatingHead
#define LineBreakModeTailTruncation NSLineBreakByTruncatingTail,
#define LineBreakModeMiddleTruncation NSLineBreakByTruncatingMiddle
#else
#define LineBreakModeWordWrap UILineBreakModeWordWrap
#define LineBreakModeCharacterWrap UILineBreakModeCharacterWrap
#define LineBreakModeClip UILineBreakModeClip
#define LineBreakModeHeadTruncation UILineBreakModeHeadTruncation
#define LineBreakModeTailTruncation UILineBreakModeTailTruncation
#define LineBreakModeMiddleTruncation UILineBreakMo
#endif
//下面的代碼是使用GCD的一個模板
//dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// // switch to a background thread and perform your expensive operation
//
// dispatch_async(dispatch_get_main_queue(), ^{
// // switch back to the main thread to update your UI
//
// });
//});
iOS全局變量設置
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
iOS開發小點·UISlider正確的滑軌寬度設置姿勢
陳滿iOS
2018-10-23 07:07:11
iOS開發小點·移除所有子視圖
陳滿iOS
2018-10-19 07:05:10
iOS開發小點·NSString過濾特定字符
陳滿iOS
2018-10-18 07:05:26
公司Atlassian JIRA無法打開:Unable to round-trip http request to upstream: EOF
陳滿iOS
2018-10-16 07:04:32
iOS開發驗證:設置UITableView的Footer視圖透明
陳滿iOS
2018-10-13 07:03:22
iOS開發小點·更新指定第三方庫
陳滿iOS
2018-10-13 07:03:22
iOS開發驗證:取消UITableView的Footer自帶的懸停效果
陳滿iOS
2018-10-13 07:03:22
iOS報錯記錄:dyld: could not load inserted library '/usr/lib/libgmalloc.dylib' because image not found
陳滿iOS
2018-10-12 07:02:56
iOS開發·狀態欄設置技巧2:更新狀態欄
陳滿iOS
2018-10-12 07:02:56
Git/SourceTree·查看單個文件提交記錄
陳滿iOS
2018-10-10 07:08:28
iOS開發小坑·不要initWithFrame和init兩個方法都放
陳滿iOS
2018-10-10 07:08:28
iOS·UITableView分割線顏色,隱藏,邊距(寬度,起點)等設置
陳滿iOS
2018-10-10 07:08:28
報錯筆記:Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
陳滿iOS
2018-10-10 07:08:28
iOS開發·設置狀態欄顏色的小結與誤區
陳滿iOS
2018-09-30 06:59:52