0

I am developing an application in which i have used SKView as view for View Controller.

I paused the view when user tap any button on screen and push the new UIViewController:

Pause View Code

self.emitterView.paused = true;

func settingButtonPressed(sender: UIButton) {
    self.emitterView.paused = true;
    let viewCtrl = EDUIUtility.loadViewControllerFromStoryboard(EDConstant.StoryboardFileName, viewCtrlStoryboardId: EDConstant.SettingViewCtrlID)
    self.pushViewController(viewCtrl)
}

On viewWillAppear i just resume the view by following code:

resume View Code

self.emitterView.paused = false;

override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    self.emitterView.paused = false;
}

But it is not working view is still paused until i tapped on a screen. I also checked the update method of scene presented by emitter view and working.

Note: Same Code is working fine on application background and foreground.

View Controller Push and Pop

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)
}
Saurav Nagpal
  • 1,247
  • 1
  • 10
  • 27
  • From what I am guessing, self.emitterView may not be the same object from when you pause to when you resume, could you post some more code and clarify a little bit about what is going on – Knight0fDragon Nov 18 '15 at 15:14
  • The other thing that may be happening if I interpret this a different way, is you pause the game, a new view controller pops ups, you close the new view controller, and expect the game to unpause at that moment. If this is the case, how are you presenting the new view controller, and how are you returning? viewWillAppear may not be called in some circumstances. – Knight0fDragon Nov 18 '15 at 15:16
  • @Knight0fDragon Thanks for the reply. 1) Self.emitterView is IBOutlet. 2)I checked that view will appear is called. It is just push and pop of navigation controller. – Saurav Nagpal Nov 18 '15 at 17:39
  • That means nothing in regards to your problem, just that it is the variable that is associated with the view, ok if it is called, then we need to investigate further, paste the entire function that .paused is being used in. – Knight0fDragon Nov 18 '15 at 17:43
  • @Knight0fDragon sorry i did not get that. If you are asking for Emitter view then it is an IBOutlet and class of emitter view is SKView in storyboard. – Saurav Nagpal Nov 18 '15 at 17:47
  • I am asking for the entire viewwillappear code, and the class that it is in, and the function that pauses, with the class that is in – Knight0fDragon Nov 18 '15 at 17:49
  • @Knight0fDragon Done – Saurav Nagpal Nov 18 '15 at 17:52
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/95474/discussion-between-saurav-nagpal-and-knight0fdragon). – Saurav Nagpal Nov 18 '15 at 17:52

0 Answers0