I am making an iPhone app and I need it to be in portrait mode, so if the user moves the device sideways, it does not automatically rotate. How can I do this?
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.
To disable orientations for a particular View Controller, you should now override
supportedInterfaceOrientationsandpreferredInterfaceOrientationForPresentation.If you’re targeting something older than iOS 6, you want the
shouldAutorotateToInterfaceOrientation:method. By changing when it returns yes, you’ll determine if it will rotate to said orientation. This will only allow the normal portrait orientation.Note that
shouldAutorotateToInterfaceOrientation:has been deprecated in iOS 6.0.