In my app, I have about a dozen different view controllers, pushed onto or popped from the stack in different orders. When a view has appeared (I’m using viewDidAppear method) I need to determine whether this is because this view has just been pushed onto the stack or because one of its subviews was popped from the stack.
I went through this question: viewWillDisappear: Determine whether view controller is being popped or is showing a sub-view controller
But I don’t think it’s helping me very much. Any suggestions please?
What you could do is have a BOOL property on your view controller, called alreadyPushed or something similar. Then in your viewDidAppear method check if it is false (Which it will be the first time the viewDidAppear is called), if it is set it to true.
Then when a subview viewController is popped the viewDidAppear method would check to see if the alreadyPushed property is set to true, if it is you know that a subview has just been popped.