Is there a way to lock the orientation of a UIWebView? With Obj-C, JS, or Html? I don’t want to have a button or anything I just want it to be locked to portrait as soon as the app opens up.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Looks like this stack overflow post may indirectly answer your question. When the iPhone is rotated, the ‘top level’ view is sent the notification, and that view is responsible for laying out its subviews.
If your UIWebView is the top level view, it will autorotate itself. However, if you put the UIWebView inside of another view, and have the view controller for that ‘container’ view implement the shouldAutorateToInterfaceOrientation method like this:
That would probably prevent the UIWebView from knowing the interface was rotated. Note that I haven’t actually tried this, but it should would work.