strong weak copy

 
copy的使用
    如果是mutable,则copy为新的obj(引用计数为1);
    入股市immutable,则retain;
 
strong 指向某个对象,引用计数+1
 
assign
 
weak    指向某个对象,但是不+1
 
NSString
NSNumber
NSString/NSMutableString 
NSArray/NSMutableArray 
NSDictionary/NSMutableDictionary 
NSSet/NSMutableSet
 
对变量的修饰符
__strong    +1
__weak        不加1,空位nil
__unsafe_unretained    不加1,空的时候就是野指针    可以忽略
 
apple文档:
https://developer.apple.com/library/ios/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226-CH1-SW11
 
http://www.jianshu.com/p/4a1d1921284b

猜你喜欢

转载自quding0308.iteye.com/blog/2293614
今日推荐