谁能解释为什么在使用 loadView 时 viewDidLoad 没有被调用?我的理解是 viewDidLoad 仍然应该被调用。
- (void)loadView
{
CGRect currentFrame = [[UIScreen mainScreen] applicationFrame];
UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(currentFrame.origin.x, currentFrame.origin.y, currentFrame.size.width, currentFrame.size.height)];
myView.backgroundColor = [UIColor redColor];
self.view = myView;
[myView release];
[super loadView];
}
- (void)viewDidLoad {
//this never happens
NSLog(@"VIEW DID LOAD!");
[super viewDidLoad];
}