Last active
December 10, 2015 17:08
-
-
Save lerosua/4465614 to your computer and use it in GitHub Desktop.
ARC中的一些规则
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 大意是说,在 ARC 中,一般outlet属性都推荐使用 weak,应该使用 strong 的 outlet 是 File's Owner连接到 nib 的顶层对象。 | |
| 顺便提一下ARC其他属性的规则: | |
| strong:等同于"retain",属性成为对象的拥有者 | |
| weak:属性是 weak pointer,当对象释放时会自动设置为 nil | |
| unsafe_unretained:等同于之前的"assign",只有 iOS 4 才应该使用 | |
| copy:和之前的 copy 一样,复制一个对象并创建 strong 关联 | |
| assign:对象不能使用 assign,但原始类型(BOOL、int、float)仍然可以使用 | |
| http://blog.csdn.net/yiyaaixuexi/article/details/7864974 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment