溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

iOS全局變量設(shè)置

發(fā)布時(shí)間:2020-07-08 15:09:52 來源:網(wǎng)絡(luò) 閱讀:602 作者:leeyulong 欄目:移動(dòng)開發(fā)

//  AppConfig.h
   創(chuàng)建一個(gè).h文件作為全局設(shè)置
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

#define DARK_BACKGROUND  [UIColor colorWithPatternImage:[UIImage p_w_picpathNamed:@"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]

//新浪微博設(shè)置
#define kSinaAppKey            @"3835906094"
#define kSinaAppSecret         @"f7efce5aec66546a192a55dc4ff0ca58"
#define kSinaAppRedirectURI    @"http://sns.whalecloud.com/sina2/callback"
#define kSinaSSoCallbackScheme @"sinaweibosso.3835906094"

//騰訊微博設(shè)置
#define kQQAppKey             @"3835906094"
#define kQQAppSecret          @"f7efce5aec66546a192a55dc4ff0ca58"
#define kQQAppRedirectURI     @"http://sns.whalecloud.com/sina2/callback"

//全局應(yīng)用
#define MyApp ((AppDelegate*)[[UIApplication sharedApplication] delegate])

//友盟統(tǒng)計(jì) -- 用戶
#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;
}

//文本對(duì)齊方式
#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的一個(gè)模板
//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
//
//    });
//});


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI