iOS强弱引用宏
2016-01-07 12:19
495 查看
弱引用:
#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif
强引用:
#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif
#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif
强引用:
#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif
相关文章推荐
- 欢迎使用CSDN-markdown编辑器
- iOS开发之CocoaPods与Github的简单使用
- IOS各种调试技巧豪华套餐
- iOS学习之路-简易图片浏览器
- iOS开发错误日志
- IOS探索之从拍照中获取图像对应的ALAsset
- 自定义iOS上双击Home键截屏切换,保护应用程序隐私
- iOS Newbie - Xcode 7 & iOS 9 前篇(非技术)
- iOS应用程序的生命周期
- iOS 百度地图_回调不走_onGetGeoCodeResult不执行
- Mac&iOS Socket
- 浅谈iOS Push 在iOS6/7/8/9中的进化
- IOS 枚举定义
- 微软自拍应用iOS版发布
- iOS类别(Category)和扩展(Extension)
- ios 隐藏顶部状态栏
- IOS后台运行 之 后台播放音乐
- IOS为文字和图片添加阴影效果
- iOS每日一记----------密码输入工具 InputPasswordView
- ios9下,使用storyboard进行多人合作新改变/