Two interfaces are set up in the storyboard.
Use
in your code[self.navigationController pushViewController:[[SCMainViewController alloc]init] animated:YES];
How to jump to the past without loading
Can't we use pure code to jump anymore? . Can I only use segue?
曾经蜡笔没有小新2017-05-17 10:07:01
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"xxx" bundle:nil];
SCMainViewController *vc = [storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([SCMainViewController class])];
[self.navigationController pushViewController:vc animated:YES];
習慣沉默2017-05-17 10:07:01
You can jump and feel your Stroyboard
上相对应的 ViewController
没有关联 Class
- SCMainViewController
.
習慣沉默2017-05-17 10:07:01
id loadViewControllerFromStoryboard(NSString *name,NSString *identifier)
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:name bundle:nil];
UIViewController *vc = nil;
if (identifier == nil)
{
vc = [storyboard instantiateInitialViewController];
}
else
{
vc = [storyboard instantiateViewControllerWithIdentifier:identifier];
}
if ([vc isKindOfClass:[UIViewController class]]) {
return vc;
}
return nil;
}
漂亮男人2017-05-17 10:07:01
First fill in the StoryBoard ID in storyBoard
Then load the viewController using the following code:
UIViewController *listController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"listViewController"];