iOS 纯代码跳转到Xib界面和Storyboard界面

纯代码跳转到Xib界面或者Storyboard界面,不能按照一般的跳转写法来跳转,会出现空白界面。

//跳转到Xib界面
MyViewController *vc = [[MyViewController alloc] initWithNibName:@"Xib名字" bundle:[NSBundle mainBundle]];

[self.navigationController pushViewController:vc animated:YES];

跳转到Storyboard界面

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Storyboard名字" bundle:[NSBundle mainBundle]];

MyViewController *vc = [sb instantiateViewControllerWithIdentifier:@"Storyboard ID"];

[self.navigationController pushViewController:vc animated:YES];

 

posted on 2019-09-03 13:57  高彰  阅读(1517)  评论(0编辑  收藏  举报

导航