Properties declared as instance variables too?

后端 未结 1 1729
予麋鹿
予麋鹿 2021-01-19 11:15

This code works:

    @interface StringStuff : NSObject {

    }
    @property (nonatomic, retain) NSString *String1;
    @property (nonatomic, retain) NSStri         


        
相关标签:
1条回答
  • 2021-01-19 11:52

    Legacy; it used to be (and still is on 32 bit Mac OS X targeted code) that the ivar declarations were required. That is no longer true on iOS, the simulator and 64 bit OS X.

    Note that it is common to @synthesize iVar = iVar_; to prevent accidental direct access where self.iVar is really required.

    0 讨论(0)
提交回复
热议问题