UIWebView inside programmatically created UIView. How to autorotate it?
In my app, when a user selects a cell from a UITableView, I create a UIView programmatically, add it to the window object, then create an UIWebView and a UIButton and add them as subviews to that view I created.
myView = programmatically created view
webView = the UIWebView that is a subview of myView
button = the UIButton that is a subview of myView and is just a "Close" button displayed on top of the WebView
The question is how do I make that programmatically created view autorotate when the user rotates his/her phone to landscape (of course,开发者_如何学Go the webview should also autorotate so the user can read the webpage better)?
Your programmatically created view should rotate with everything else. Make sure you are returning YES in the method - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation in your view controller.
精彩评论