I am approaching mental trying to solve this issue:
The situation:
I have a pretty basic application, an an MMDrawerController with a tableview inside, which links to a uitabbarcontroller when an item is pressed. Inside the first page of that is an embedded youtube UIWebView which when pressed played a youtube video fullscreen.
Here is what is happening.
- Press video, opens in fullscreen and starts playing
- UITabBar viewWillDisappear fires
- Root MMDrawerController viewWillAppear fires
- Video Ends
- User back to UITabBar they started and everything seems fine even though it 'disappeared' earlier
Now I put booleans in the ViewWillAppears / Disappears of the two views to check what the current state of the app is like. Usually it's 0,1 indicating either the table is open or the uitabbarcontroller is open. After the video, they show 0,0. If I press back on the navigation I get "Unbalanced calls to begin/end appearance transitions" when navigating from wherever I am.
Right now If I listen for the start of the youtube video and then fire:
[self.navigationController popToRootViewControllerAnimated:NO];
I can prevent the unbalanced calls, from occurring and the user can continue to navigate the app. However they don't get to watch the video and they just get thrown back a view.
As well in 3. I can check for 0, 0 on the two controllers and then pretty much reboot the whole app. But thats not a good solution.
Intended outcome:
The user can press the uiwebview, watch the video, and afterwards they are returned to where they left off. If they hit back on the navigation controller, no unbalanced appearance transitions.
I've tried a bunch of stuff, like
[self.navigationController poptoViewController:...]
From what I gather at this point, it has something to do with fullscreen videos loading in the root controller (hence its viewWillAppear firing at 3.) but I'm not getting 'placed' back correctly afterwards. Something like
[self.navigationController heyTheUserIsPresentlyIn:self]
That I can call after the video goes away would be crazy good.
Any assistance is much appreciated, although I've been on this for hours and hours, If I'm a moron any links to docs or sections in books would help a lot. Thanks.