When very much XXX.h file attribute yy design, the external design is yy (readonly). The property cannot be changed by the outside world.
At the same time the problem also came, the XXX class can not change the internal changes to the YY attribute. Have you ever had a messy moment?
。。 Y_y
Then you'll find two ways to do it like this:
One: pointer
Never underestimate the power of the pointer, in the internal can be used in the obj->_yy way to change the YY property, this way is also true
It's a little bit yy.
Instantly turn red with wood//self . Yyname = @ "skyming"; Self->_yyname = @ "skyming"; or _yyname = @ "skyming";
Second: declaring properties again
Seemingly very formal appearance, assume that their own write the class attributes are not many, the company has no other code specifications. placed directly in
I'll just declare it again.
Control it. Declaration in H
@interface Xxx:nsobject@property (nonatomic, ReadOnly, strong) NSString *yyname; @end
The declaration in. M @interface XXX () @property (nonatomic, ReadWrite, strong) NSString *yyname; @end
Suppose you have the same property. h files,. m files are all readonly, and you get an error.
Of course, if the attribute is more, or in the SDK, then directly write a private. h Bar
And that's how it's done within the company's internal SDK 、、、
Assuming your company's SDK is like this, just silently like it, y_y
"ios" ReadOnly iOS under the introduction of combat