我正在开发一个应用程序,其中我使用SKView作为View Controller的视图。
当用户点击屏幕上的任何按钮并按下新的UIViewController时,我暂停了视图:
暂停查看代码
self.emitterView.paused = true;
func settingButtonPressed(sender: UIButton) {
self.emitterView.paused = true;
let viewCtrl = EDUIUtility.loadViewControllerFromStoryboard(EDConstant.StoryboardFileName, viewCtrlStoryboardId: EDConstant.SettingViewCtrlID)
self.pushViewController(viewCtrl)
}
在viewWillAppear上,我只需按照以下代码恢复视图:
恢复查看代码
self.emitterView.paused = false;
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
self.emitterView.paused = false;
}
但它不工作视图仍然暂停,直到我点击屏幕。 我还检查了发射器视图和工作所呈现的场景的更新方法。
注意:相同的代码在应用程序背景和前台工作正常。
查看控制器推送和弹出
func pushViewController(viewController:UIViewController){
UIView.transitionWithView(self.navigationController!.view, duration: 0.50,
options: UIViewAnimationOptions.TransitionFlipFromRight, animations: {
self.navigationController!.pushViewController(viewController, animated: false)
}, completion: nil)
}
func popViewController(){
UIView.transitionWithView(self.navigationController!.view, duration: 0.50,
options: UIViewAnimationOptions.TransitionFlipFromLeft, animations: {
self.navigationController!.popViewControllerAnimated(false)
}, completion: nil)
}