Discussion Forums  >  Xcode, Errors, Installing, Configuring

Replies: 16    Views: 110

Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
05/03/13 09:00 AM (12 years ago)

Can I Make iPad App Portrait View Only?

Basically, I would like to know if I can make my iPad app portrait view only? I have tried playing around with the orientation view buttons in xcode, but nothing seems to work and the app continues to rotate if I rotate device to landscape. Any suggestions would be grateful.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/03/13 09:03 AM (12 years ago)
do you want both iPhone and ipad to be portrait only
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
05/03/13 09:05 AM (12 years ago)
iPhone is fine, but iPad can't seem to get it to stay portrait.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/03/13 09:07 AM (12 years ago)
bot you don't want rotations in either. and they are both portrait
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/03/13 09:09 AM (12 years ago)
Go to you appdelegate.m remove from lines 1225 and 1226 mask |= UIInterfaceOrientationMaskLandscapeLeft; mask |= UIInterfaceOrientationMaskLandscapeRight; comment them out or delete et voila
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/03/13 09:12 AM (12 years ago)
this will force every screen in your app to be portrait iphone or iPad
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
05/03/13 09:14 AM (12 years ago)
the fix you done the other day to make just the video screen landscape and portrait, will the code you offered still work?
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/03/13 09:17 AM (12 years ago)
probably not but try it, lol give me a minute
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
05/03/13 09:29 AM (12 years ago)
Didn't work, still rotates.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/03/13 09:42 AM (12 years ago)
try this with it as well you will need to put this in all the plugins you want to remain portrait that other way will work with ios 6 and higher this deals with below // For force landscape in for iOS lower than 6.0 add this to all screens you want auto rotate or it wont on ios5 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsPortrait(interfaceOrientation); }
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
05/03/13 09:49 AM (12 years ago)
cool, will try now. Where about's do I add the code?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
05/03/13 10:22 AM (12 years ago)
Hi Kittsy not sure where to add the code.
 
tb
buzztouch Evangelist
Profile
Posts: 2050
Reg: Nov 03, 2011
Oxford
32,300
like
05/03/13 10:22 AM (12 years ago)
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/03/13 10:37 AM (12 years ago)
Add it to the .m file that you want to always be in portrait outside any other methods at the end
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
05/03/13 10:52 AM (12 years ago)
didn't work!
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
05/03/13 11:03 AM (12 years ago)
OK, got it working following some of the code change from the link Annandale posted. Thanks Kittsy!
 
tb
buzztouch Evangelist
Profile
Posts: 2050
Reg: Nov 03, 2011
Oxford
32,300
like
05/03/13 01:35 PM (12 years ago)
@Dragon, You may know that the meet is next week, if you don't have the email, here's the details: Location (same as before): Berlitz Language Centre 131 High Street Oxford OX1 4DH Date + Time: Tuesday 7th May 16:00 (2 hours)
 

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.