2013-06-20 29 views
0

我有类型的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方法?我应该寻找什么?我很困惑!!

+0

检查这个帖子http://stackoverflow.com/a/10900817/2315974 – danypata

+0

我不想改变我的navctrl的rootvc,只是为了让它打到viewdidload。我正在启动它,它只是从来没有击中viewdidliad –

回答

1

好吧,我发现了这个问题,我一直在做这么多项目的编辑,我不小心删除了方法didFinishLaunchingWithOptions开头的最重要的一行。这是这样的:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 

无论如何,所以我现在要杀自己,随意推荐死亡的方法(高乐氏鸡尾酒,走进流量),如果你想写写我一些好听的话来在我的悼词中也发表了 。

谢谢。

+0

作为苦修回答三个SO问题,接受你自己的答案,并将全部原谅:-) – herzbube

+0

我不能,我试过了,但它不可能,我洗过两次到目前为止,走的方式耻辱,走开,它没用。 –

+0

您必须等待48小时才能接受您自己的答案。 – herzbube