[英]what is the difference between a readwrite property and a nonatomic assign property?
[英]What is the difference between readonly and readwrite in Objective C?
任何人都可以告诉我iPhone SDK中的readonly
和readwrite
属性之间的区别吗?
readwrite指示应将该属性视为读/写。 此属性是默认属性。 @implementation
块中都需要getter和setter方法。 如果在实现块中使用@synthesize
指令,则会合成getter和setter方法。
readonly表示该属性是只读的。 如果指定readonly,则@implementation
块中只需要一个getter方法。 如果在@implementation
块中使用@synthesize
指令,则只合成getter方法。 此外,如果您尝试使用点语法分配值,则会出现编译器错误。
希望这个能对您有所帮助..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.