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.
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.
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];
Open the story board in your editor and click on any of the view controllers. Doing this will list all the proxy objects that you have come to be used to see when you selected any xib. Following image must help you understand better.
Now goto the Identity Inspector tab and enter you class name in the highlighted text field
Create one Xib
file set the FilesOwner
class as connecter.h
. The while creating the instance of connector class
[[connecter alloc] initWithNibName:@"Nib_Name" bundle:nil];
Do this to bind your connector class with xib:[here i have bind ViewController class with xib]
And connect the view with File's owner. And your Connecter class must be of type ViewController and have the method
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}