純代碼跳轉到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];