Probleme mit dem Storyboard in iOS
伊谢尔伦
伊谢尔伦 2017-05-17 10:05:01
0
5
680

Im Storyboard sind zwei Schnittstellen eingerichtet.

Im Code verwenden

[self.navigationController pushViewController:[[SCMainViewController alloc]init] animated:YES];

Wie man in die Vergangenheit springt, ohne zu laden

Können wir zum Springen keinen reinen Code mehr verwenden? . Kann ich nur segue

verwenden?
伊谢尔伦
伊谢尔伦

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

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

可以跳转的,感觉你的 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;
}
漂亮男人

先要在storyBoard里面填好StoryBoard ID

然后使用下面的代码加载viewController:

UIViewController *listController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"listViewController"];
小葫芦

1.绑定类

2.push

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!