0

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

4

1 回答 1

1

好的,我发现了问题,我一直在对这个项目进行大量编辑,以至于我不小心删除了方法 didFinishLaunchingWithOptions 开头最重要的一行。这是:

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

无论如何,所以我现在要自杀,随意推荐一种死亡方法(clorox 鸡尾酒,走进车流),如果你想写一些关于我的好话也发表在我的悼词中。

谢谢。

于 2013-06-20T20:28:52.707 回答