Automatic Reference Counting (ARC) 总结
来源:互联网 发布:html 展示json数据 编辑:程序博客网 时间:2024/05/17 00:53
ARC的判断准则:只要没有强指针指向对象,就会释放对象
ARC特点
- 不允许调用
release
、retain
、retainCount
。 - 允许重写dealloc,但是不允许调用[super dealloc]。
- @property的参数
strong :成员变量是强指针(适用于OC对象类型)
weak :成员变量是弱指针(适用于OC对象类型)
- 以前的retain改为用strong
指针分2钟:
- 强指针:默认情况下,所有的指针都是强指针 __strong
- 弱指针:__weak
Xcode的ARC转换
将非ARC的代码转化为ARC:
如果工程是 ARC的,可以将部分代码更改为非 ARC 模式:
如果工程不是 ARC 的,可以将部分代码更改为 ARC 状态
ARC 的循环引用
当两端循环引用的时候,解决方案:
- ARC
1端用strong,另1端用weak
- 非ARC
1端用retain,另1端用assign
0 0
- Automatic Reference Counting (ARC) 总结
- Automatic Reference Counting (ARC)
- Automatic Reference Counting (ARC)
- ARC (Automatic Reference Counting)
- ARC(Automatic Reference Counting)
- Automatic Reference Counting (ARC) 简介
- iOS Automatic Reference Counting(ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- ARC(Automatic Reference Counting )技术概述
- ARC(Automatic Reference Counting )技术概述
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- Xcode 4.2 中的Automatic Reference Counting (ARC)
- 操作系统的基本概念
- 埃式筛法
- Spfa单源最短路径算法
- virtual Box 安装 增强包
- ArrayBlockingQueue源码阅读
- Automatic Reference Counting (ARC) 总结
- 介绍两种风格的URL
- JAVA学习代码——泛型
- 数据结构之栈的Java实现
- 操作系统的基本安全机制
- GOF之责任链模式
- Block编程总结【iOS】
- 正则表达式
- offsetTop、offsetLeft、offsetWidth、offsetHeight