-1

i am using both storyboard and xib in my project and i want to go xib files from storyboard but can't reverse it. so how i go to storyboard from xib files. thnx in advance. storyboard to xib:

Dashboard1ViewController *tempView = [[Dashboard1ViewController alloc]       initWithNibName:@"Dashboard1ViewController" bundle:nil];
    tempView.passemail = [matches valueForKey:@"email"];
    [self.view addSubview:tempView.view];

it works fine but xib to storyboard i have used this code

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"loginUI" bundle:nil];
login2ViewController *vc = [sb instantiateViewControllerWithIdentifier:@"login2"];
vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:vc animated:YES completion:NULL];

but it is not working.

Bhanu
  • 1,249
  • 10
  • 17
Rita
  • 1

2 Answers2

0

the following method is working for me. make sure that your identifier is correct

YourViewController *urViewController = (YourViewController *)[[UIStoryboard storyboardWithName:storyboardName bundle:nil]     instantiateViewControllerWithIdentifier:@"storyboardID"];
[self presentViewController:urViewController animated:YES completion:nil];
karthikPrabhu Alagu
  • 3,371
  • 1
  • 21
  • 25
0

Change nil to [NSBundle mainBundle]

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"loginUI" 
                                             bundle:[NSBundle mainBundle]];
Rukshan
  • 7,902
  • 6
  • 43
  • 61