I’m an Objective-C newbie and I’m reading “iPhone programming” by Alasdair Allan. While reading, I found this code:
@interface RootController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
UITableView *tableView;
NSMutableArray *cities;
}
// warning: remember this tableView
@property (nonatomic, retain) IBOutlet UITableView *tableView;
The relative implementation starts this way:
@implementation RootController
@synthesize tableView;
Now: I learnt that @synthesize is a sort of shortcut to avoid boring getters and setters.
But I’ve some question:
- in the code of the implementation tableView is never explicitly called but the dealloc releases it;
- if it never gets called explicitly why the @synthesize?
Is it mandatory for IBOutlets to be synthesized?
From Memory Management of Nib Objects,