I've got a UIWebView inside a UINavigationController in a UITabBarController. Sometimes the pages displayed by the UIWebView contains HTML5 video objects.
The video starts playing as expected, but doesn't support landscape mode.
I think that this might be since not all of my view controllers inside the UITabBarcontroller autorotates to landscape mode (I've heard about the "all view controllers inside a UITabBarController should support autorotation to landscape mode to make the UITabBarController autorotate).
Anyone that knows any workaround? Possibly some solution to open the video itself outside of the app?
Thanks!
UPDATE 2011-03-15
I'll rephrase myself a bit, but I didn't feel it was enough to create a new question. I've got the follow hierarchy:
UITabBarController
UINavigationController (NC-A)
UITableView
UIWebView (pushed from UITableView)
UINavigationController (NC-B)
A number of UITableViews
UINavigationController (NC-C)
A number of UITableViews
I want the UIWebView (in NC-A), which sometimes contains HTML5 video objects (like mentioned above), to support landscape mode (and autorotate/-resize when the user flip开发者_JAVA技巧s the phone itself)
But I don't want to implement the autorotation in the views controlled by NC-B and NC-A
To support the autorotation in a UITabBarController, I've read that "all views currently 'on top' in each of the tabs have to implement the shoudAutorotateToInterfaceOrientation (and return YES for the orientation in question)".
Is there any way to solve this?
It'd be fairly hacky, but you could capture the "play" event of the html5 video in javascript, then fire a fake URL which your webView delegate would intercept.
From there, build an MPMoviePlayerController, attach it to your root view controller (or put it up modally on top of everything else) and set your autorotation the way you want it.
Benefit is that the user is guaranteed the native movie player. Drawback is it's pretty hacky.
The solution I went with was to present the UIWebView modally. Then the whole view supported landscape orientation and therefore also the UIWebView.
精彩评论