RE: Objective-C - When to use 'self'
I understand when SELF is actually required 100% to properly set a retained property but is there any overhead to continually calling the getter method, instead of accessing directly even after you've already obtained your retained object? Is the program more efficient not continuously calling it?
Your ViewController contains many retained subviews (ie. multiple retained UIViews) which get added to the root main view.
Inside your viewDidLoad: method is there any overhead doing:
[self.mySubViewA setBackgroundColor:[UIColor blueColor]];
[self.mySubViewA setOpaque:NO];
[self.mySubViewA setAlpha:1.0f];
[self.view addSubView:self.mySubViewA];
[self.mySubViewB setMyCustomPropertyInThisView:[UIColor redColor]];
....
instead of:
// no calls to SELF at all (i.e saving time on method get cycle calls and directly
// accessing the properties currently retained at that address.
// Assumption here is that mySubViewA is loaded through NIB and is already alloc'd.
[mySubViewA setBackgroundColor:[UIColor blueColor]];
[mySubViewA setOpaque:NO];
[mySubViewA setAlpha:1.0f];
// Is this faster? since we just instantly assign the UIView @ mySubViewA to the main view
// as opposed to a method get cycle?
[self.view addSubView:mySubViewA];
[mySubViewB setMyCustomPropertyInThisView:[UIColor redColor]];
....