首先在工程的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"];