iOS 常用的宏定义


#define APP_WINDOW [[[UIApplication sharedApplication] delegate] window]
#define SHOW_ALERT(msg) UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@
" 提示 " message:msg delegate:nil cancelButtonTitle:@ " 确定 " otherButtonTitles:nil, nil];\
[alert show];

//宏定义偏好设置
#define USER_D [NSUserDefaults standardUserDefaults]

// 宏定义字体
#define COMMON_FONT [UIFont fontWithName:@ "MicrosoftYaHei" size: 15 ]


// 拨打电话
#define PHONE(number) UIWebView * callWebview = [[UIWebView alloc] init];\
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@
"tel://%@" ,number]]]];\
[self.view addSubview:callWebview];

// 通知中心
#define NOTI_CENTENT [NSNotificationCenter defaultCenter]

#define ScreenSize           [[UIScreen mainScreen] bounds].size

// 屏幕的宽 iPhone iPad 通用
#define ScreenWidth (([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height)
// 屏幕的高 iPhone iPad 通用
#define ScreenHeight (([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) ? [[UIScreen mainScreen] bounds].size.height : [[UIScreen mainScreen] bounds].size.width)

//Document 下文件的路径 , 可直接 NSDictionary *dictionary=[[NSDictionary alloc]initWithContentsOfFile:PlistFilePathName];
#define PlistFilePathName [(NSString *)( (NSArray *)NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES )[ 0 ]) stringByAppendingPathComponent:@ "currentuserinfo.plist" ]





/** 十进制颜色色值转系统颜色 */
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/ 255.0f green:(g)/ 255.0f blue:(b)/ 255.0f alpha:(a)]

/** 十六进制颜色转系统颜色 */
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000 ) >> 16 ))/ 255.0 green:((float)((rgbValue & 0xFF00 ) >> 8 ))/ 255.0 blue:((float)(rgbValue & 0xFF ))/ 255.0 alpha: 1.0 ]


/** iOS 系统版本 */

#define SYSTEM_VERSION() [[UIDevice currentDevice].systemVersion floatValue]

#define ios9x [[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0f

/**iOS 手机型号 */
#define iphone4x_3_5 ([UIScreen mainScreen].bounds.size.height== 480.0f )
#define iphone5x_4_0 ([UIScreen mainScreen].bounds.size.height==
568.0f )
#define iphone6_4_7 ([UIScreen mainScreen].bounds.size.height==
667.0f )
#define iphone6Plus_5_5 ([UIScreen mainScreen].bounds.size.height==
736.0f )















  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值