创建一个新的storybord,让页面与storybord进行连接,直接推出storybord。
1. 创建一个独立的storybord
2. 页面进行连接
3. 用代码直接进行推
#pragma mark 类扩展进行页面的扩展
UIViewController *pushStoryboard(NSString *storyboardName,NSString *identifier) {
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:identifier]; //test2为viewcontroller2的StoryboardId
return viewController;
}
/**
如果index = 0,则利用类扩展方法进行推页面
否则不用类扩展推页面
*/
int index = 1;
if (index == 0) {
[self.navigationController pushViewController: pushStoryboard(@"Storyboard", @"test2") animated:YES];
} else {
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:@"test2"]; //test2为viewcontroller2的StoryboardId
[self.navigationController pushViewController:viewController animated:YES];
}