- 浏览: 886057 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (466)
- iPhone, iOS , Objective-c (155)
- 数据库 (20)
- 设计模式 (5)
- 第三方包管理,cocoapod (2)
- 版本管理, SVN, Subversion, Git (1)
- Google, Android, Java (14)
- Wordpress (1)
- 职业素养 (3)
- 版本管理,git (3)
- 前端小技巧 (2)
- flash (1)
- javascript (5)
- Ruby (0)
- 编程语言 (1)
- 网络常识 (1)
- 找到生活好感觉 (5)
- 产品经理 (1)
- markdown (1)
- 云服务器 (1)
- iPhone (116)
- iOS (116)
- Objective-c (116)
- 学习技巧 (2)
- Google (5)
- Android (6)
- Java (21)
- python (1)
- sqlite (3)
- node.js (2)
- mongodb (2)
- 学习技巧,阅读 (2)
- 软件测试 (3)
- 架构设计 (2)
- 设计 (1)
- Spring framework (3)
- junit (1)
- Linux (2)
- 软件 (1)
- Struts2 (1)
- 版本管理 (3)
- SVN (3)
- Subversion (3)
- Git (3)
- mysql (5)
- quartz (1)
- 无关技术 (1)
- 前端 (1)
- Redis (1)
- 产品管理 (0)
- 计算机常识 (1)
- 计算机科学 (0)
- swift (1)
- 服务器 (2)
- 搜索 (1)
- Scala (1)
- J2EE (1)
- maven (1)
- 前端css (1)
- 英语 (1)
- 消息队列 (1)
- kafka (0)
- apache kafka (4)
- netbeans (1)
- IDE (2)
- 歌词 (1)
- 过滤器实现 (1)
- linux vim vi (1)
- jmeter (1)
- springcloud (1)
最新评论
-
hujingnemo:
不知道为什么打不开
CHM如何改编字体大小 -
weiboyuan:
求答案 weiboyuanios@163.com
iOS软件工程师面试题(高级) -
xueji5368:
这个现在已经广泛使用了嘛!
RoboGuice入门 -
Yao__Shun__Yu:
...
CHM如何改编字体大小 -
353144886:
非常之详细 美女求认识
sqlite数据类型 datetime处理
http://blog.csdn.net/likendsl/article/details/37764813
另一种RAC装B写法的解说
http://www.jianshu.com/p/3d6c4416db5e
weak strong dance
常看到一个block要使用self,会处理成在外部声明一个weak变量指向self,在block里又声明一个strong变量指向weakSelf:
weakSelf是为了block不持有self,避免循环引用,而再声明一个strongSelf是因为一旦进入block执行,就不允许self在这个执行过程中释放。block执行完后这个strongSelf会自动释放,没有循环引用问题。
可以用以下的宏定义
另一种RAC装B写法的解说
http://www.jianshu.com/p/3d6c4416db5e
weak strong dance
常看到一个block要使用self,会处理成在外部声明一个weak变量指向self,在block里又声明一个strong变量指向weakSelf:
__weak __typeof(self)weakSelf = self; self.backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{ __strong __typeof(weakSelf)strongSelf = weakSelf; }];
weakSelf是为了block不持有self,避免循环引用,而再声明一个strongSelf是因为一旦进入block执行,就不允许self在这个执行过程中释放。block执行完后这个strongSelf会自动释放,没有循环引用问题。
可以用以下的宏定义
#ifndef weakify #if __has_feature(objc_arc) #define weakify( x ) \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wshadow\"") \ autoreleasepool{} __weak __typeof__(x) __weak_##x##__ = x; \ _Pragma("clang diagnostic pop") #else #define weakify( x ) \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wshadow\"") \ autoreleasepool{} __block __typeof__(x) __block_##x##__ = x; \ _Pragma("clang diagnostic pop") #endif #endif #ifndef strongify #if __has_feature(objc_arc) #define strongify( x ) \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wshadow\"") \ try{} @finally{} __typeof__(x) x = __weak_##x##__; \ _Pragma("clang diagnostic pop") #else #define strongify( x ) \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wshadow\"") \ try{} @finally{} __typeof__(x) x = __block_##x##__; \ _Pragma("clang diagnostic pop") #endif #endif
发表评论
-
oc为啥不用try catch
2016-03-23 11:56 1365简单的来说,Apple虽然同时提供了错误处理(NSError) ... -
ReactiveCocoa笔记
2016-03-14 12:31 0为什么使用MVVM?为什么使用ReactiveCocoa? 概 ... -
PINCache
2016-01-19 15:11 903PINCache是线程安全的键值缓存框架,用来储存难以获取或重 ... -
Swift设计模式
2015-12-29 12:04 0Swift设计模式 -
Understanding Swift access control
2015-12-29 12:03 0Swift takes an unusual approuac ... -
cocoapods因GEM_HOME升级遇到问题解决办法
2015-12-17 14:40 877Installing CocoaPods on OS X 10 ... -
swift 闭包的比较写法
2015-12-16 11:10 707let names = ["Chris", ... -
iOS 生成二维码,生成条形码图片
2015-12-03 15:44 1411#pragma mark - 生成条形码以及二维码 // ... -
解决cocoapods 更新慢的问题
2015-11-23 17:01 707最近使用CocoaPods来添加第三方类库,无论是执行pod ... -
iOS中级面试题
2015-11-20 15:12 1135OneV‘s Den在博客里出了10道iOS面试题,用他的话是 ... -
cocoapods出错解决方法
2015-11-09 13:09 702自定义GEM_HOME $ mkdir -p $HOME/So ... -
oc时间从美国时间改到中国时间
2015-10-19 14:12 919_formatter = [[NSDateFormatt ... -
27个iOS开发库
2015-07-24 16:10 733超长慎入列表: DZNEmptyDataSet(UI,空表格 ... -
Values of type 'NSInteger' should not be used as format arguments; add an explic
2015-07-24 10:10 796Values of type 'NSInteger' shou ... -
iOS架构心得体会
2015-05-18 18:35 766好的架构不是设计出来的,而是进行出来的。 我的iOS工程架构 ... -
UICollectionView NSInternalInconsistencyException出现的原因
2015-05-11 11:32 3358'NSInternalInconsistencyExcepti ... -
XLForm-iOS表单库
2015-05-08 14:44 871XLForm是最灵活和强大的iOS类库,用于创建动态table ... -
Info.plist Utility Error: “Info.plist couldn't be opened because there is no suc
2015-05-06 16:13 643http://stackoverflow.com/questi ... -
iOS中Autolayout中各种情况的使用的width,height策略
2015-04-30 15:33 636可以总结为: 如果项目不支持横屏显示,使用w:Compac ... -
一句话加上下拉刷新
2015-04-29 18:22 729怎么一句话添加上拉刷新? https://github.co ...
相关推荐
The Block
QUICC Engine Block Reference Manual with ProtocolInterworking Supports: MPC8360E/MPC8358E MPC8568E/MPC8568/MPC8567E/MPC8567 MPC8569E/MPC8306/MPC8306S/MPC8309 MSC8144/MSC8144E/MSC815x Family P1021/P...
Often used more narrowly in reference to an external deliverable, which is a deliverable that is subject to approval by the project sponsor or customer” by [PMI, 2000]. Examples of outcomes are a ...
How to use the OB block
Linux The Journaling Block Device
it is expected to transition to the latter as the block rewards dwindle. There has been an implicit belief that whether miners are paid by block rewards or transaction fees does not affect the ...
The book is suitable as the main text for a graduate course on antenna diversity and space-time coding, as well as for self-studies and as a reference for researchers and engineers. Each chapter is ...
This did not drive me underground (perhaps due to my strong instinct for self-preservation, known in certain circles as cowardice) but somehow provided a good motivation to explore the field of ...
This is the reference manual for Ruby, including a description of all the standard library modules, a complete reference to all built-in classes and modules (including all the new and changed methods ...
The speed control loop uses a proportional-integral controller to produce the quadrature-axis current reference iq* which controls the motor torque. The motor flux is controlled by the direct-axis ...
generation Integrated Block for PCI Express within a Xilinx FPGA, including support for PCI Express 3.0 at 8.0 Gb/s data rates. This breadth of experience has provided Xilinx the expertise to develop ...
The Block chain Developer
A reference to an invalid page (a page that is not in your working set) is referred to as a page fault. Assuming the page reference does not result in an access violation, a page fault can be either ...
problem, with the coordinate block chosen by a Gauss-Southwell-q rule based on sufficient predicted descent. We establish global convergence to first-order stationarity for this method and, under a ...
ew blockchain-based business models are enabled. The system could create an ...the system could access and analyze the information to provide a warning to traffc congestion or inclement weather
In this paper, we propose a new lightweight 64-bit block cipher, which we call MIBS, suitable for resource-constrained devices, such as low-cost RFID tags. We also study its hardware implementation ef...
软件手册How to use the OB block.docx
For those programming in a commercial/business environment, where coding practices are strictly enforced, this book would be a good desk reference, as the author includes discussion of sound ...
and clear and concise descriptions of the underlying principles and theoretical concepts to provide a better understanding of the operation of the system's components. It covers all essential system ...