我试图处理这个问题太久了。请给我你的任何想法。
我通过发送本地通知从 SKScene 呈现视图控制器。[[NSNotificationCenter defaultCenter] postNotificationName:@"closeScene" object:nil];
通知在开始视图控制器中处理。
- (void)viewDidLoad{ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeScene) name:@"closeScene" object:Nil];
[super viewDidLoad];}
然后:
-(void)closeScene {
//Remove the SKView, or present another viewController here.
constructionViewController *view = [[constructionViewController alloc] init];
[self presentViewController:view animated:YES completion:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"closeScene" object:nil];
}
每次发送通知时,我都会收到警告:
Warning: Attempt to present <constructinoViewController: 0x10ae64160> on <constructinoViewController: 0x10ab329d0> whose view is not in the window hierarchy!
任何帮助都将不胜感激。先感谢您!