Copy vs Retain in Objective C
2015-09-23 22:53
639 查看
NSMutableArray *copiedArray = [array mutableCopy];
NSMutableArray *retainedArray = [array retain];
[retainedArray addObject:@"Retained Third"];
[copiedArray addObject:@"Copied Third"];
NSLog(@"array = %@",array);
NSLog(@"Retained Array = %@",retainedArray);
NSLog(@"Copied Array = %@",copiedArray);
2015-09-23 22:50:24.791 temp[2473:154359] array = (
First,
Second,
"Retained Third"
)
2015-09-23 22:50:24.792 temp[2473:154359] Retained Array = (
First,
Second,
"Retained Third"
)
2015-09-23 22:50:24.792 temp[2473:154359] Copied Array = (
First,
Second,
"Copied Third"
)
相关文章推荐
- Objective-C之property属性分析
- Objective-C type encodings
- struts2 Map<String,Object>session心得 浅析
- Mybatis之配置文件中的objectFactory节点内容说明
- 打开页面出现Object reference not set to an instance of an object错误
- 关于swift与objective-c混合编译
- Objective-C入门20:Block
- 在java代码里写Map<String, ?>和Map<String, Object>都是可以用的,他们两个有什么区别?
- Objective-C Runtime Messaging
- 改善Objective-C的日志输出
- Objective-C入门18:KVO
- QMetaObject之invokeMethod说明和使用
- Object-c基础语法
- DynamicCRM清理PrincipalObjectAccess表,清理POA,清理WorkFlowLog
- DynamicCRM清理PrincipalObjectAccess表,清理POA,清理WorkFlowLog
- Objective-C GCC Code Block Evaluation C Extension ({…})语法
- Objective-C中NSNumber与NSDictionary的用法简介
- WaitForSingleObject函数的使用
- Object-C 验证手机号
- Json-smart实现JSONObject、JSONString、Beans之间的转换