- 浏览: 904201 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (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 1404简单的来说,Apple虽然同时提供了错误处理(NSError) ... -
ReactiveCocoa笔记
2016-03-14 12:31 0为什么使用MVVM?为什么使用ReactiveCocoa? 概 ... -
PINCache
2016-01-19 15:11 948PINCache是线程安全的键值缓存框架,用来储存难以获取或重 ... -
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 926Installing CocoaPods on OS X 10 ... -
swift 闭包的比较写法
2015-12-16 11:10 755let names = ["Chris", ... -
iOS 生成二维码,生成条形码图片
2015-12-03 15:44 1472#pragma mark - 生成条形码以及二维码 // ... -
解决cocoapods 更新慢的问题
2015-11-23 17:01 756最近使用CocoaPods来添加第三方类库,无论是执行pod ... -
iOS中级面试题
2015-11-20 15:12 1182OneV‘s Den在博客里出了10道iOS面试题,用他的话是 ... -
cocoapods出错解决方法
2015-11-09 13:09 746自定义GEM_HOME $ mkdir -p $HOME/So ... -
oc时间从美国时间改到中国时间
2015-10-19 14:12 979_formatter = [[NSDateFormatt ... -
27个iOS开发库
2015-07-24 16:10 769超长慎入列表: DZNEmptyDataSet(UI,空表格 ... -
Values of type 'NSInteger' should not be used as format arguments; add an explic
2015-07-24 10:10 844Values of type 'NSInteger' shou ... -
iOS架构心得体会
2015-05-18 18:35 815好的架构不是设计出来的,而是进行出来的。 我的iOS工程架构 ... -
UICollectionView NSInternalInconsistencyException出现的原因
2015-05-11 11:32 3414'NSInternalInconsistencyExcepti ... -
XLForm-iOS表单库
2015-05-08 14:44 908XLForm是最灵活和强大的iOS类库,用于创建动态table ... -
Info.plist Utility Error: “Info.plist couldn't be opened because there is no suc
2015-05-06 16:13 689http://stackoverflow.com/questi ... -
iOS中Autolayout中各种情况的使用的width,height策略
2015-04-30 15:33 685可以总结为: 如果项目不支持横屏显示,使用w:Compac ... -
一句话加上下拉刷新
2015-04-29 18:22 770怎么一句话添加上拉刷新? https://github.co ...
相关推荐
QUICC Engine Block Reference Manual with ProtocolInterworking Supports: MPC8360E/MPC8358E MPC8568E/MPC8568/MPC8567E/MPC8567 MPC8569E/MPC8306/MPC8306S/MPC8309 MSC8144/MSC8144E/MSC815x Family P1021/P...
标题 "The Block" 提到的是一个可能与设计、排版或者特定字体相关的概念。在IT领域,尤其是在图形设计和用户界面(UI)设计中,“Block”通常指的是布局中的一个单元或区域,它可能包含了文本、图像或其他元素。这种...
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 ...
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 ...
`cudaMemset` sets the values of a block of memory on the device to a specified value. This function is useful for initializing device memory before using it in computations. **1.5.9 cudaMemset2D** `...
1. 使用弱引用(Weak Reference):对于`self`,可以将其在Block内声明为弱引用`__weak typeof(self) weakSelf = self;`,然后在Block内部使用`weakSelf`,避免`self`直接持有Block。 ```objc - (void)viewDidLoad ...
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 ...
and the description "Ruby.Pocket.Reference.Jul.2007 learning ruby 的 can reference" indicate that this is a concise guide designed to provide quick access to essential information about the Ruby ...
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 ...
The Block chain Developer
Hence, it becomes possible for the attacker to issue a command to all the nodes, that target a single node (for example, all nodes in the botnet might be commanded by the attacker to send a TCP SYN ...
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 ...
- 当Block作为类的成员变量时,Block内部引用了`self`,这样`self`就持有Block,Block又持有`self`,形成循环。 - 使用GCD(Grand Central Dispatch)时,若在队列中使用Block操作`self`,未正确处理引用,也可能...
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...
- __block_storage_type* ^__strong:栈上的Block,如果离开作用域会被自动销毁。 - id __block __weak:如果Block被复制到堆上,引用会变为弱引用,防止循环引用。 - Block __attribute__((__blocks__(byref)))...
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 ...
This removes the requirement to examine every row or page lock on the table to determine whether a transaction can lock the entire table. Lock Mode The code shown in the slide represents how the ...
当对象持有Block,而Block内部又引用了这个对象时,可能导致对象无法正确释放,这就是所谓的“强引用循环”(strong reference cycle)。为了避免这种情况,可以使用`__weak`关键字弱引用对象,或者在Block内部使用`...