Problems with storyboard in iOS
伊谢尔伦
伊谢尔伦 2017-05-17 10:05:01
0
5
726

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?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(5)
曾经蜡笔没有小新
 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"xxx" bundle:nil];
 SCMainViewController *vc = [storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([SCMainViewController class])];
 [self.navigationController pushViewController:vc animated:YES];
習慣沉默

You can jump and feel your Stroyboard 上相对应的 ViewController 没有关联 Class - SCMainViewController.

習慣沉默
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;
}
漂亮男人

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"];
小葫芦

1. Binding class

2.push

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template