1
由於UIViewController中的關鍵字「did」和「will」,我不確定將代碼放在viewDidLoad和viewWillAppear中調用super之前/之後的位置,以便使代碼有效運行。在調用super之前/之後放置代碼viewDidLoad和viewWillAppear
例如:
- (void)viewDidLoad
{
[super viewDidLoad];
// Code is here because whatever
// setup in super should been done first
// before we can do anything
}
- (void)viewWillAppear:(BOOL)animated
{
// Code should be here to finish
// whatever we want to do in our view
// before calling super
[super viewWillAppear:animated];
}
這可以應用於didRotate和willRotate爲好。它是否正確?