Storyboard 並非只能有一個。大型專案中,可依功能將畫面拆分到不同 Storyboard,讓流程更清楚,也減少單一檔案過於龐大。
若要從目前 Storyboard 跳到另一個 Storyboard 的 view controller,可先建立 UIStoryboard 物件,再以 instantiateViewControllerWithIdentifier: 取得目標控制器,最後用 navigation controller push。
UIStoryboard *secondStoryBoard = [UIStoryboard storyboardWithName:@"Storyboard2" bundle:nil];
UIViewController *test2 = [secondStoryBoard instantiateViewControllerWithIdentifier:@"test2"];
[self.navigationController pushViewController:test2 animated:YES];
這裡的 test2 是目標 view controller 在 Interface Builder 中設定的 Storyboard ID。只要 ID 正確,就能在不同 Storyboard 之間自由跳轉。