iOS 敏捷开发,常用的宏
来源:互联网 发布:centos 开启ftp端口 编辑:程序博客网 时间:2024/05/04 11:31
在做项目的时候,直接拿过来使用,可以大幅度提高开发速度。 下面是 个人总结的一些宏定义。如果大家有其他的常用的宏定义,欢迎添加。我会定期更新这个blog…..话不多说,直接上干货// 在宏的参数前加上一个#,宏的参数会自动转换成c语言的字符串#define MRKeyPath(objc,keyPath) @(((void)objc.keyPath, #keyPath))//** 加载xib ***********************************************************************************#define LoadNib(x) [[NSBundle mainBundle] loadNibNamed:@(x) owner:nil options:nil][0]//** 沙盒路径 ***********************************************************************************#define PATH_OF_APP_HOME NSHomeDirectory()#define PATH_OF_TEMP NSTemporaryDirectory()#define PATH_OF_DOCUMENT [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]//** DEBUG LOG *********************************************************************************#ifdef DEBUG#define MRLog( s, ... ) NSLog( @"< %@:(%d) > %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )#else#define MRLog( s, ... )#endif//** 获得当前的 年 月 日 时 分 秒 *****************************************************************************#define CurrentSec [[NSCalendar currentCalendar] component:NSCalendarUnitSecond fromDate:[NSDate date]]#define CurrentMin [[NSCalendar currentCalendar] component:NSCalendarUnitMinute fromDate:[NSDate date]]#define CurrentHour [[NSCalendar currentCalendar] component:NSCalendarUnitHour fromDate:[NSDate date]]#define CurrentDay [[NSCalendar currentCalendar] component:NSCalendarUnitDay fromDate:[NSDate date]]#define CurrentMonth [[NSCalendar currentCalendar] component:NSCalendarUnitMonth fromDate:[NSDate date]]#define CurrentYear [[NSCalendar currentCalendar] component:NSCalendarUnitYear fromDate:[NSDate date]]//** 角度转换成弧度 ******************************************************************************************#define ANGEL(x) (x)/180.0 * M_PI//* Frame (宏 x, y, width, height)**************************************************************************// App Frame#define Application_Frame [[UIScreen mainScreen] applicationFrame]// App Frame Height&Width#define App_Frame_Height [[UIScreen mainScreen] applicationFrame].size.height#define App_Frame_Width [[UIScreen mainScreen] applicationFrame].size.width// MainScreen Height&Width#define Main_Screen_Height [[UIScreen mainScreen] bounds].size.height#define Main_Screen_Width [[UIScreen mainScreen] bounds].size.width// View 坐标(x,y)和宽高(width,height)#define ViewxPos(v) (v).frame.origin.x#define ViewyPos(v) (v).frame.origin.y#define ViewWidth(v) (v).frame.size.width#define ViewHeight(v) (v).frame.size.height#define MinFrameX(v) CGRectGetMinX((v).frame)#define MinFrameY(v) CGRectGetMinY((v).frame)#define MidFrameX(v) CGRectGetMidX((v).frame)#define MidFrameY(v) CGRectGetMidY((v).frame)#define MaxFrameX(v) CGRectGetMaxX((v).frame)#define MaxFrameY(v) CGRectGetMaxY((v).frame)// 系统控件默认高度#define kStatusBarHeight (20.f)#define kTopBarHeight (44.f)#define kBottomBarHeight (49.f)#define kCellDefaultHeight (44.f)#define kEnglishKeyboardHeight (216.f)#define kChineseKeyboardHeight (252.f)
判断不同版本执行不同方法的宏
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_0ios7以上的#else// iPhone OS SDK 7.0 之前版本的处理#endif
0 0
- iOS 敏捷开发,常用的宏
- iOS敏捷开发之道,常用的宏定义总结
- iOS敏捷开发常见的宏定义
- 常用的敏捷开发模式
- 敏捷开发常用实践
- 常用敏捷开发方法
- iOS开发常用的宏
- ios开发常用的宏
- iOS开发常用的宏
- iOS开发常用的宏
- iOS开发常用的宏
- ios开发常用的宏
- ios开发常用的宏
- ios开发常用的宏
- ios开发常用的宏
- ios开发常用的宏
- ios开发常用的宏
- iOS开发常用的宏
- JSLink文件中使用field的自定义属性
- Android官方文档的一个RelativeLayout的案例
- 新手搭建ThinkPHP框架
- O2O模式的普及化
- Kafka Tools
- iOS 敏捷开发,常用的宏
- HTMLParser 学习篇下
- 黑马程序员——JAVASE-其他类
- The期path "" is not a valid path to the 3.11.0-15-generickernel headers
- Linux stat详解(进程CPU,内存)
- 【转】C/C++函数的系统调用的几种方式
- Associative机制使用场景[objective-c有两个扩展机制:category扩展方法和associative扩展属性]
- 在Struts2使用集合对象保存表单提交参数
- UVa10935 用map将string映射成int处理问题