2013年5月23日 星期四

宣告property的前綴關鍵字

atomic vs nonatomic primarily ensures that complete values are returned from synthesized getters and that complete values are written by synthesized setters.
readwrite vs readonly determines whether a synthesized property has a synthesized accessor or not (readwrite has a setter and is the default, readonly does not).
assign vs retain vs copy determines how the synthesized accessors interact with the Objective-C memory management scheme:
  • assign is the default and simply performs a variable assignment
  • retain specifies the new value should be sent -retain on assignment and the old value sent -release
  • copy specifies the new value should be sent -copy on assignment and the old value sent -release.

沒有留言:

張貼留言