我有类型的ItemsViewControlleruitableviewcontroller,与xib,从appdelegate加载,永不加载?
@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方法?我应该寻找什么?我很困惑!!
检查这个帖子http://stackoverflow.com/a/10900817/2315974 – danypata
我不想改变我的navctrl的rootvc,只是为了让它打到viewdidload。我正在启动它,它只是从来没有击中viewdidliad –