Xcode Storyboard and xib connection

Naveen picture Naveen · Mar 22, 2013 · Viewed 15k times · Source

I have one story board project with many view controllers and i created one class named "connecter.h,connector.m " now can i connect this class to one .xib file ?

Please help me.

Answer

nsgulliver picture nsgulliver · Mar 22, 2013

You can create XIB when you create connector.h and connector.m by selecting it subclass of UIViewController and click on the checkbox for: "With XIB for User Interface". If you have created already .m & .h files then you can just add a new GUI file by selecting View from the window & finally setting its Controller Custom class to connector You could have StoryBoard and XIB together in the same project. See for more help.

For presenting the view Controller you could use the following code

YourViewController *viewController=[[YourViewController alloc]initWithNibName:@"ViewControllerName" bundle:nil];

[self presentViewController:viewController animated:YES completion:nil];

In case of NavigatinController

   [self.navigationController pushViewController:viewController animated:YES];