Ray's playground

 

Numbers, Strings, and Collections(Chapter 15 of Programming in Objective-C 2.0)

  The line
  @property (copy, nonatomic) NSString *name, *email;

  lists the attributes copy and nonatomic for the properties.The copy attribute says to make a copy of the instance variable in its setter method, as you did in the version you wrote. The default action is not to make a copy, but to instead perform a simple assignment (that’s the default attribute assign), an incorrect approach that we recently discussed.

  The nonatomic attribute specifies that the getter method should not retain or autorelease the instance variable before returning its value. 

posted on 2010-10-22 09:42  Ray Z  阅读(221)  评论(0编辑  收藏  举报

导航