iOS开发笔记--一些实用的宏定义
来源:互联网 发布:市场份额数据 编辑:程序博客网 时间:2024/05/24 03:22
这是在工作中常用的一些比较实用的宏定义
- // 声明单件类的类方法
- #define DECLARE_SINGLETON_FOR_CLASS(classname) \
- + (classname*)shared##classname;
- // 获取单件实例的宏定义
- #define GET_SINGLETON_FOR_CLASS(classname) \
- [classname shared##classname]
- // 合成单件类
- #define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) \
- \
- static classname *shared##classname = nil; \
- \
- + (classname *)shared##classname \
- { \
- @synchronized(self) \
- { \
- if (shared##classname == nil) \
- { \
- shared##classname = [[self alloc] init]; \
- } \
- } \
- \
- return shared##classname; \
- } \
- \
- + (id)allocWithZone:(NSZone *)zone \
- { \
- @synchronized(self) \
- { \
- if (shared##classname == nil) \
- { \
- shared##classname = [super allocWithZone:zone]; \
- return shared##classname; \
- } \
- } \
- \
- return nil; \
- } \
- \
- - (id)copyWithZone:(NSZone *)zone \
- { \
- return self; \
- } \
- \
- - (id)retain \
- { \
- return self; \
- } \
- \
- - (NSUInteger)retainCount \
- { \
- return NSUIntegerMax; \
- } \
- \
- - (oneway void)release \
- { \
- } \
- \
- - (id)autorelease \
- { \
- return self; \
- }
0 0
- iOS开发笔记--一些实用的宏定义
- iOS开发笔记--一些实用的宏定义
- ios开发中,比较实用的全局宏定义分享
- iOS开发常见的宏定义(实用)
- iOS开发一些实用的小方法
- iOS开发的一些实用小技巧
- 关于iOS开发真机,模拟器的一些宏定义
- ios 开发中用到的一些宏定义
- IOS开发中常用的一些宏定义
- 一些iOS开发中一些实用的Demo分享
- IOS开发笔记之常用的宏定义
- iOS开发笔记之typedef的定义
- 摘抄的一些比较实用的宏定义
- iOS开发中一些实用方法的总结
- iOS开发笔记---objective-c宏定义
- iOS一些实用的技巧
- iOS 一些常用的宏定义
- iOS 自己使用的一些宏定义
- startService与bindService
- 其它互联网公司对opentsdb的改进
- Resolving conflicts between main and test APK
- iOS开发笔记--异步加载图片在TableView中的应用
- java的运行机制详解 .
- iOS开发笔记--一些实用的宏定义
- 使用组合模式与迭代器模式遍历文件夹中所有文件
- 图像预处理~对左右部分分别直方图均衡化
- 微信抢红包辅助工具 AccessibilityService
- initWithCoder: 与initWithFrame:的区别
- iOS开发笔记--将视图或者按钮设置为圆形
- Redis安装部署
- Big-endian_littleEndian
- poj-3321-Apple Tree(树状数组)