You Can Customize Synthesized Instance Variable Names @property

As mentioned earlier, the default behavior for a writeable property is to use an instance variable called _propertyName

If you wish to use a different name for the instance variable, you need to direct the compiler to synthesize the variable using the following syntax in your implementation:

@implementation YourClass
@synthesize propertyName = instanceVariableName;
...
@end

For example:

@synthesize firstName = ivar_firstName;

In this case, the property will still be called firstName, and be accessible through firstName and setFirstName: accessor methods or dot syntax, but it will be backed by an instance variable called ivar_firstName.

Important: If you use @synthesize without specifying an instance variable name, like this:

@synthesize firstName;
the instance variable will bear the same name as the property. 

In this example, the instance variable will also be called firstName, without an underscore.

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html#//apple_ref/doc/uid/TP40011210-CH5-SW2

原文地址:https://www.cnblogs.com/feng9exe/p/8422304.html