I'm building "spritekit" game, i need to present another viewController
than main viewcontroller
.
I tried to perform this with delegates and with notification center to send ask to present new view controller. Both ways correctly called this function inside main viewController
(tuViewController) from "SkScene" (tuGameOver). The point is to correctly present FacebookLikeViewDemoViewController
-(void)showShareScreen{
NSLog(@"VIEWCONTROLER RECEIVED");
FacebookLikeViewDemoViewController *helpVC = [[FacebookLikeViewDemoViewController alloc]initWithNibName:@"FacebookLikeViewDemoViewController" bundle:nil];
[self presentViewController: helpVC animated: YES completion:nil];
}
When this function is executed i got NSlog
and after that terminating with uncaught exception of type NSException
SIGABRT Error.
I also tried to modify this function to :
-(void)showShareScreen{
NSLog(@"VIEWCONTROLER RECEIVED");
UIViewController *vc = [[UIApplication sharedApplication] keyWindow].rootViewController;
FacebookLikeViewDemoViewController *helpVC = [[FacebookLikeViewDemoViewController alloc]init];
[vc presentViewController: helpVC animated: YES completion:nil];
}
And with this, i didn't get crash, and something appears but this is blank black screen.
FacebookLikeViewDemoViewController
is typical viewController
Class, pinned up to view Controller in storyboard.
Any ideas?
try this code :
Mc.Lover (chuckle) came up with a solution for presenting a VC in SKScene. Below is the gist of his solution. I have added it to the touchesBegan: method so you can easily test it.
His original Q&A is here.