Neil
Neil

Reputation: 2058

Storyboard -> XIB | Loading Views

I have recently converted from Storyboard to XIB. Because I have a large number of views, and it is easier to work with XIBs over a git repository. (Also the app will now be available for iOS 4).

Now here is the code that I used to have, but I am wondering how I would achieve the same without Storyboard, but with XIBs:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle bundleForClass:[self class]]];
infoView *infoViewController = [storyboard instantiateViewControllerWithIdentifier:[defaults objectForKey:@"launchScreen"]];
infoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:infoViewController animated:YES completion:nil];

Upvotes: 1

Views: 1707

Answers (1)

Carina
Carina

Reputation: 2260

First,you should convert infoView from Storyboard to infoView.xib , and then :

    infoView *infoViewController = [[infoView alloc]initWithNibName:@"infoView" bundle:nil];
    infoViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentViewController:infoViewController animated:YES completion:nil];

Upvotes: 2

Related Questions