0

In story board we just right drag the button to it's destination and create a seque.

What about if I have external XIBs for all those viewControllers in storyboard? I can't drag the button again. The button is in external XIBs, not in storyboard anymore.

So what should I do?

user4951
  • 32,206
  • 53
  • 172
  • 282

1 Answers1

2

You should to create an IBOutlet for this button. For example, it's name "buttonPressed". And then implement this method.

- (IBOutlet)buttonPressed
{
    YourViewController *yourViewController = [[YourViewController alloc] initWithNibName:@"YourViewController" bundle:nil];
   [self.navigationController pushViewController:yourViewController animated:YES]; 

}
tagirkaZ
  • 469
  • 7
  • 19
  • That's the pre ios5 ways to do this. What about if I want seque, animation, etc. – user4951 Sep 14 '12 at 05:40
  • You can use segues only with Storyboards. If you work with external XIBs in isn't possible. But you can use custom animation. [This](http://stackoverflow.com/questions/1406037/custom-animation-for-pushing-a-uiviewcontroller) can help you I think. – tagirkaZ Sep 19 '12 at 09:44
  • Can I do this hybrid. Some view controllers got story board and the other use external XIB? – user4951 Sep 19 '12 at 09:50
  • I think, [this](http://stackoverflow.com/questions/9521714/storyboards-and-nibs-compatible) is exatcly what you are looking for – tagirkaZ Sep 19 '12 at 10:04