Why must I define variables twice in the Header file?
问题 Why must I define variables twice in the header file? What differences are there between these variables? The first definition is here: @interface MyController: UIViewController { NSInteger selectedIndex; } The second definition is here: @property (nonatomic) NSInteger selectedIndex; 回答1: What you're seeing was required in earlier versions of Objective-C, but isn't any more. In the first versions of Objective-C used by NeXT up until the new runtime was introduced (with Objective-C 2.0 on Mac