This is the code used on the main menu, when the user presses play, however when that screen is presented (ViewController.m) it shows the error
Warning: Attempt to present on whose view is not in the window hierarchy!
-(IBAction)play:(id)sender
{
if(IS_IPAD)
{
ViewController *view_obj = [[ViewController alloc]initWithNibName:@"ViewController_iPad" bundle:[NSBundle mainBundle]];
[self presentViewController:view_obj animated:YES completion:nil];
}
else if ([AISGlobal isIphone5thGeneration])
{
ViewController *view_obj = [[ViewController alloc]initWithNibName:@"ViewController_iPhone5" bundle:[NSBundle mainBundle]];
[self presentViewController:view_obj animated:YES completion:nil];
}
else
{
ViewController *view_obj = [[ViewController alloc]initWithNibName:@"ViewController_iPhone" bundle:[NSBundle mainBundle]];
[self presentViewController:view_obj animated:YES completion:nil];
}
}
In the AppDelegate.m file it shows this in the 'didFinishLaunchingWithOptions' section;
if(IS_IPAD)
{
self.start_screen_obj = [[Start_screen alloc] initWithNibName:@"Start_screen" bundle:nil];
}
else if ([AISGlobal isIphone5thGeneration])
{
self.start_screen_obj = [[Start_screen alloc] initWithNibName:@"Start_screen_iphone5" bundle:nil];
}
else
{
self.start_screen_obj = [[Start_screen alloc] initWithNibName:@"Start_screen_iphone" bundle:nil];
}
self.start_screen_obj.view.multipleTouchEnabled = YES;
self.window.rootViewController = self.start_screen_obj;
[self.window makeKeyAndVisible];