1
- (void)viewDidLoad {
    [super viewDidLoad];
//..do stuff..
}

or

- (void)viewDidLoad {
//do stuff
    [super viewDidLoad];
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
  • possible duplicate of [\[super viewDidLoad\] convention](http://stackoverflow.com/questions/844195/super-viewdidload-convention) – Jacob Relkin Aug 20 '10 at 19:38

2 Answers2

5

Generally, if you're setting things up (e.g. init), super should go first. If you're taking things down (e.g. dealloc), super should go last.

Brian
  • 15,599
  • 4
  • 46
  • 63
1
- (void)viewDidLoad {
    [super viewDidLoad];

    //..do stuff..
}

First of all let the super view controller do its initiation and then make yours.

2 reasons:

  • You might depend on that initialization
  • You might want to override super view controller's initialization

Once I had to deal with a bug of one of the developers in my team and eventually the bug was caused exactly by this - the [super viewDidLoad]; was the last line in the viewDidLoad method...

Michael Kessler
  • 14,245
  • 13
  • 50
  • 64