stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
05/22/14 08:26 PM (10 years ago)

Locking in Portrait

I last asked this 6 months ago and all responses didn't seem to work so I figured I'd ask again and see if anyone had any new ideas. It should be simple: How can I make my app restricted to only portrait mode? Thanks. Steve
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/22/14 10:23 PM (10 years ago)
ios or android?
 
kingelessar
Lost but trying
Profile
Posts: 155
Reg: Mar 10, 2014
UK
6,500
like
05/23/14 02:44 AM (10 years ago)
For Android you need to add android:screenOrientation="portrait" into the activities in the manifest file. For iOS it's in the General settings for your app's target.
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
05/23/14 05:07 AM (10 years ago)
It's IOS and I checked off the portrait box in the target but it still rotates.
 
kingelessar
Lost but trying
Profile
Posts: 155
Reg: Mar 10, 2014
UK
6,500
like
05/23/14 06:00 AM (10 years ago)
How curious. When it's set for iphones only it doesn't but if it's universal it still rotates. But I guess with iPads you expect to be able to rotate the app. If the app is designed to work on iPads, then maybe it has to be able to cope with being rotated? Mine is set to iphone and then it works well to fix it to portrait. And it can still be used on ipads as well.
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
05/23/14 11:26 AM (10 years ago)
In the file "YourApp_appDelegate.m" Remove the following lines around line 1043 and 1044: mask |= UIInterfaceOrientationMaskLandscapeLeft; mask |= UIInterfaceOrientationMaskLandscapeRight; Thats it :) I do this with all of my apps, as I don't really do landscape apps much. If doing a universal app, leave line 1045 in there... thats the one that lets it rotate upside down in portrait mode. Apple requires that the app rotates for ipad apps, but just rotating upside down is enough to meet their standards. That way, your app still rotates, but won't go into landscape mode.
 
stevek
Aspiring developer
Profile
Posts: 808
Reg: Dec 24, 2011
great neck
8,080
like
05/23/14 01:15 PM (10 years ago)
Angry Ninja, That worked like a charm! Thanks ever so much. Steve
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
05/28/14 01:56 PM (10 years ago)
Damn, for once I knew the solution and I come after the end of the battle... Farcat
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.