简体   繁体   中英

What is the difference between readonly and readwrite in Objective C?

任何人都可以告诉我iPhone SDK中的readonlyreadwrite属性之间的区别吗?

readwrite Indicates that the property should be treated as read/write. This attribute is the default. Both a getter and setter method are required in the @implementation block. If you use the @synthesize directive in the implementation block, the getter and setter methods are synthesized.

readonly Indicates that the property is read-only. If you specify readonly, only a getter method is required in the @implementation block. If you use the @synthesize directive in the @implementation block, only the getter method is synthesized. Moreover, if you attempt to assign a value using the dot syntax, you get a compiler error.

For more visit this reference

Hope, this will help you..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM