0

I have a strange problem.

I have 2 XIBs and 1 ViewController. The One XIB ist for iPhone the other for iPad. In the XIB for iPad there are just bigger images.

- (void)pressShare:(UIBarButtonItem *)sender
{
     NSString *nibName = @"";
     if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
         nibName = @"MCComunicationViewController";
     }
     if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
         nibName = @"MCComunicationViewControlleriPad";
     }

     MCComunicationViewController *comVC = [[MCComunicationViewController alloc] initWithNibName:nibName bundle:nil];
     UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:comVC];
     navController.navigationBar.tintColor = [MCColorFactory emerald];
     navController.navigationBar.barTintColor = [UIColor whiteColor];

     [self.navigationController presentViewController:navController animated:YES completion:nil];
}

On iPhone 5 with iOS 7.1 its working perfectly on iPad with iOS 7.1 it's crashing.

Debugger on iPad running says

po navController
<UINavigationController: 0x16578470>

po navController.viewControllers
<__NSArrayI 0x16590390>(
       <MCComunicationViewController: 0x165780d0>
)

po comVC
<MCComunicationViewController: 0x165780d0>

It's crashing with SIGABRT in main.m and when I Debug step by step it's crashing by [self.navigationController presentViewController:navController animated:YES completion:nil]; :/ Any ideas?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Miralem Cebic
  • 1,276
  • 1
  • 15
  • 28

2 Answers2

0

For using two xib , user Container class. If you are using container you can easy to manage data.

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
0

Try ....

 [self.navigationController pushViewController:navController animated:YES];
Parvendra Singh
  • 965
  • 7
  • 19