@synthesize IBOutlet property

Viewed 3496

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:

  1. in the code of the implementation tableView is never explicitly called but the dealloc releases it;
  2. if it never gets called explicitly why the @synthesize?

Is it mandatory for IBOutlets to be synthesized?

5 Answers
Related