狙击兽

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Assuming you have storyboard, go to storyboard and give your VC an identifier (inspector), then do:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard"bundle:nil]; UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"IDENTIFIER"]; [self.navigationController pushViewController:vc animated:YES];

Assuming you have a xib file you want to do:

UIViewController *vc = [[UIViewController alloc] initWithNibName:@"NIBNAME"bundle:nil]; [self.navigationController pushViewController:vc animated:YES];

Without a xib file:

UIViewController *vc = [[UIViewController alloc] init];[self.navigationController pushViewController:vc animated:YES];
从xib中加载UIview
posted on 2016-02-27 00:38  狙击兽  阅读(55)  评论(0)    收藏  举报