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];