首先在工程的Info一栏,查看Storyboard的名称,通常是Maincode
而后打开Storyboard,选中要获取的控件,这里是ViewController,在右侧Identity标签栏的Storyboard ID里填上名称,这里填为myViewControllerit
OK,如今就能够获取该ViewController了。class
//根据Bundle拿到Storyboard UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; //在Storyboard中经过ID获取到ViewController UIViewController *myViewController = [story instantiateViewControllerWithIdentifier:@"myViewController"];