I have an UIWebView that has an youtube's embed code (ifr开发者_如何学Pythoname). I'd like to enable both portrait and horizontal orientation for the video player, but portrait mode only for the UIWebView itself.
How can I achieve this?
The UIWebView displays its content by its orientation. There is no (easy) way to conditionally change which orientations the UIWebView allows based on its content. The only way I can imagine this working is by parsing the HTML of the web view and based on its content, allowing or disallowing certain orientations.
Regardless of all this, I would suggest either allowing both portrait and landscape for both, or only allowing portrait. This would be confusing to users if you only sometimes allowed landscape.
精彩评论