Blocks,注意
Blocks
1,阻塞线程。
2,语句块,类似C 语言的函数指针。
(注意 !!)3, 内存循环引用: Blocks 对起语句块内的对象保留 一个 strong pointer 引用,如果 该对象同时也对 该 Block 保留一个 strong pointer 引用,则会出现循环应用,而使两个对象都不能从堆里释放。
适用Blocks 的情况:
1,Enumeration.枚举。
2,View Animations .UIView 的动画。
3,Sorting.排序。
4,Notification. 事件。
5,Error Handlers.
6,Completion handlers.
7(最重要),多核多线程下(GCD), 标准C api 的形式, 与UI界面有关的操作都用在主线程里执行。
posted on
2012-06-26 11:46
linyawen 阅读(
...) 评论(
)
编辑
收藏
转载于:https://www.cnblogs.com/linyawen/archive/2012/06/26/2563422.html