I have too many views on one storyboard which is causing it to run really slow. I have been told that a solution to this issue would be to split the one storyboard into mult
First of all, breaking up a storyboard into multiple separate ones is a great idea, saves a lot of headache (especially if you are on a team and dealing with lots of merge conflicts in the storyboard file).
Now to answer your question - you cannot perform a segue between two storyboards necessarily, but one solution I've had great success with is to do something like this:
- (IBAction)buttonPressed:(id)sender {
UIViewController *otherVC = [[UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:nil] instantiateInitialViewController]; //Or get a VC by its identifier
[self.navigationController pushViewController:otherVC animated:YES];
}
Just load up the other storyboard and either call instantiateInitialViewController
or instantiateViewControllerWithIdentifier:
then do whatever transition you would like.
Hope this helps.
In Swift (iOS 8.1) this is pretty easy:
var storyboard: UIStoryboard = UIStoryboard(name: "Another", bundle: nil)
var vc = storyboard.instantiateViewControllerWithIdentifier("NextViewController") as AnotherViewController
self.showViewController(vc, sender: self)
Update for Swift 3:
let storyboard: UIStoryboard = UIStoryboard(name: "Another", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "NextViewController") as! AnotherViewController
self.show(vc, sender: self)
Swift 3
let vc = UIStoryboard(name: "StoryboardName", bundle: nil).instantiateViewController(withIdentifier: "ViewControllerIdentifier") as? ExpectedViewControllerClass
self.show(vc, sender: self)
Where the "StroboardName" is the name of your .storyboardfile. The "ViewControllerIdentifier" is the id of the View in the story board. And "self" is any UIViewController
In my case, the identifier was "chooseCountryViewController"