0

In my application i have 3 nib files. In the first nib file i have a uiwebview which redirects the user to vimeo page for user authentication for my app, after the user presses allow in that link then the control is transferred to my app, after that to display the list of videos i designed a new nib file and the third nib file to play the video user selected. But i am not able to load the second nib file after the user approval.I tried these approaches After the user presses allow and i got the access. i removed the uiwebview then i tried to load the second nib using UInib , NSbundle but the nib dint appear, i have also tried creating a separate class for the new nib and assigning the files owner of that nib to the newly created class but that approach also dint work. Then i tried using appdelegate for loading the code. i write the code like this :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

NSLog(@"in the app delegate show UI");
 CustomInterface *ci = [CustomInterface new];
 [[NSBundle mainBundle]loadNibNamed:@"Interface" owner:ci options:nil];

 UILabel *lab = [ci valueForKey:@"label"];
 [self.window.rootViewController.view addSubview:lab];
 lab.frame = CGRectIntegral(lab.frame);

 UITableView *tab = [ci valueForKey:@"table"];
 [self.window.rootViewController.view addSubview:tab];
 tab.frame = CGRectIntegral(tab.frame);
return YES; }

but by using this the intital nib and the second nib both are loading when the app is launched but i want to load the second nib after the user authentication. I have tried many other techniques like creating a new delegate and class for second nib, creating a new method showSecondNib() in the default AppDelegate but none of them worked. can you help me with this. Thank you.

Tejreddy
  • 45
  • 6

1 Answers1

0

In you app delegate use this to load nib from bundle:

self.viewController = [[UIStoryboard storyboardWithName:@"yourstoryboardname"  bundle:nil] instantiateViewControllerWithIdentifier:@"youviewcontrollername"];

This should load nib for current view.

Ashwani
  • 3,463
  • 1
  • 24
  • 31
  • It dint work, when i tried to use that i got an error saying that property viewController is not found, if i tried to create a viewController property it is giving an error ViewController class is not found did you mean UIViewController – Tejreddy Aug 29 '13 at 03:51