I have a uiwebview that plays a youtube video. How can I handle the done button action?
Right now, when I tap the done button it changes back to my app main menu (not the menu that was supposed to dismiss to) and it just freezes. Can anyone help me please?
Ps: the menu where the uiwebview is located, was previously presented modally.
The YouTube plug-in player is itself a modal view controller. It is returning to its
presentingViewControllerwhen the done button is pressed. ItspresentingViewControlleris not your modal view controller but is instead the viewController that called[presentModalViewController:animated:]to present your modal view controller. Since the original modal view controller is still active, the app behaves badly.To fix the problem,
1) Track whether the modal view controller has been presented but not dismissed.
2) In the
viewDidAppearmethod of the presenting view controller, if the modal view controller was presented and not dismissed, dismiss and present it again.For example, in controller that is presenting the modal web view controller: