标签:style blog http color 使用 os io strong
如上图所示,如何装载Storyboard中指定的ViewController?
首先,需要指定ViewController的ID,如上图右上方红色方框内的Storyboard ID。然后使用下面的代码:
[cpp] view plaincopy
UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
LeftViewController *leftController = [mainStoryboard instantiateViewControllerWithIdentifier:@"leftViewController"];
或者使用下面的代码:
[cpp] view plaincopy
UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
ViewController *leftController = [mainStoryboard instantiateViewControllerWithIdentifier:@"leftViewController"];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:leftController];
或者,你想怎么用就怎么用了。。。。。。
如何装载Storyboard中的ViewController?,布布扣,bubuko.com
如何装载Storyboard中的ViewController?
标签:style blog http color 使用 os io strong
原文地址:http://my.oschina.net/u/1402271/blog/304949