The difference between accessing a property through "propertyname" and "self.propertyname" in objective-c?

What is the relationship between accessing a property through "propertyname" and "self.propertyname" in objective-c? Can you answer in response:

  • What is the best practice?
  • How two approaches affect memory management (keep score / one responsibility for memory management)
  • Any other advantages / disadvantages

The scenario assumption may be based on the following:

Header file

@interface AppointmentListController : UITableViewController {
    UIFont *uiFont;
}
@property (nonatomic, retain) UIFont *uiFont;

Implementation

- (void)viewDidLoad {
    [super viewDidLoad];  

    uiFont = [UIFont systemFontOfSize:14.0];
    //VERSUS
    self.uiFont = [UIFont systemFontOfSize:14.0];

thank

+3
source share
2 answers

propertyname . ; .

self.propertyname . @synthesize, , @property (, , retain, self.propertyname), , .

. , , @property @synthesize , self.propertyname, . (.. @property @synthesize).

+1

. iPhone, Cocoa Touch . Cocoa, :

. KVC - , Cocoa, . . KVC , , .

, , var = value, Key-Value Observing , .

+1

All Articles