我正在开发一个应用程序,其中我使用 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)
}