当 UIViewController 启动时,我想立即启动另一个 UIViewController。这不起作用:
-(void) awakeFromNib {
UIViewController *newcontroller = [[[UIViewController alloc] init] autorelease];
...
[self presentModalViewController:newcontroller animated:YES];
}
为了使它起作用,我必须为一个方法执行 afterDelay,如下所示:
-(void) awakeFromNib {
[self performSelector:@selector(startNewController) withObject:nil afterDelay:0.5];
[super init];
}
-(void) startNewController {
UIViewController *newcontroller = [[[UIViewController alloc] init] autorelease];
...
}
是否有可能毫不拖延地让它工作?