我有一个 ItemsViewController 类型
@interface ItemsViewController : UITableViewController
现在我从 didFinishLaunchingWithOptions 中的 appdelegate 调用,就像这样
ItemsViewController *itemsViewController = [[ItemsViewController alloc] initWithNibName:@"ItemsViewController" bundle:nil];
// Create an instance of a UINavigationController
// its stack contains only itemsViewController
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:itemsViewController];
// Place navigation controller's view in the window hierarchy
[[self window] setRootViewController:navController];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
现在在 ItemsViewController.m 文件中,我确实点击了这个方法:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
但这里的问题是它从来没有命中 viewdidload 方法?我应该寻找什么?我很困惑!!