问题
I've search a lot but I can't do yet.
I've my .xib UI with some buttons, separated from main storyboard.
I need to perform an action when I press one of this button and show another view.
How can I do this directly from code such ad inside an IBAction?
回答1:
You can't perform segues from XIB to Storybaord,
Instead of it you need
1) Get Storyboard's instance.
2) Instantiate a ViewController that is inside the Storyboard (By using Storyboard ID).
3) Push that ViewController to to your navigation stack.
Here is sample code
UIViewController *vc = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"yourVcIdentifier"];
[self.navigationController pushViewController:vc animated:YES];
@"MainStoryboard" - is the file name of storybaord (note. it's without .storyboard extension)
@"yourVcIdentifier" - is ViewController's Storybaord ID.
To give a Storybaord ID to some ViewController, open the storybaord, click on the ViewController and specify the "Storyboard ID" field.

来源:https://stackoverflow.com/questions/26712758/perform-segue-from-xib-programmatically