Before talking about the usage of @property, it was mentioned that the change of @property was caused by the change of Xcode, and the root cause was the change of the compiler used by Xcode. prior to XCODE4, the compiler used by Apple was the GNU C Compiler (GCC). Since XCode4, Apple has changed Xcode's compiler to low-level Virtual machine (LLVM). in the GCC compiler era, when declaring a @property, an instance variable (instance variable) must be created for the property; in the LLVM era, you do not have to create an instance variable for this @property, and when LLVM does not find the corresponding instance variable for the property, it is automatically created for it. This instance variable, created automatically in the background, differs from the variable declared by @property only one underscore (_). code example: @property (copy, nonatomic) NSString *myname;The default hidden instance variable created is: _myname; You directly invoke this _myname instance variable, which is fully available. For example: in the. m file, do the following: _myname = @ "This is my name"; equivalent to self.myname= @ "This is my name";
Summary:Understanding the compiler history of Xcode helps to understand why some of the syntax in Xcode often changes. @Property change is one of them. Similar changes have been made: in TableView based on storyboard, there is no need to determine whether the reusable cell is empty after Xcode4.
IOS: Learn about the compilers that have been used by XCode