189 8069 5689

iOS全局变量设置-创新互联

//  AppConfig.h
  创建一个.h文件作为全局设置
#import
#import

#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]

//新浪微博设置
#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
//
//   });
//});

创新互联公司是专业的于都网站建设公司,于都接单;提供网站建设、成都做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行于都网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站栏目:iOS全局变量设置-创新互联
本文来源:http://cdxtjz.cn/article/cdhese.html

其他资讯