首页 > 如何手动初始化controller?

如何手动初始化controller?

可以通过identifier来找到 controller, 但是这个identifier通常我都是先通过sb中设置的, 我怎么不需要在sb中设置, 而通过代码设置?

这个问题我问的不好,一开始是我自己理解错了instantiateViewControllerWithIdentifier这个方法, 其实我的想法是不想通过sb来初始化controller, 还以为非要用这个方法


sb相当于一堆xib的集合,你没有id他怎么知道你要用哪个


同楼上,除非你完全不用storyBoard,而手写代码。


YourViewController * vc = [[YourViewController alloc] init];

/*
   init YourViewController code.
*/

// push viewController
[self.navigationController pushViewController:vc animated:YES];
【热门文章】
【热门文章】