Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 248

magister
I hate code!
Profile
Posts: 66
Reg: Feb 16, 2012
firenze
660
06/21/12 01:47 PM (13 years ago)

Allowing only portrait, 180 rotation, on ipad and iphone

I searched this forum thoroughly and read all related arguments about it, including a post on IDevDepot but I could not find a working solution on how to achieve just portrait rotation. It's easy to lock the screen in BT_rotatingTabBarController.m and BT_rotatingNavController.m but has anybody a working fix for allowing -only- 180 degrees vertical rotation? PS: I submitted a locked screen orientation App a week ago, not checking Apple guidelines on this very subject beforehand and now I am rushing to find a solution. Thanks.
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/21/12 05:03 PM (13 years ago)
You can do this in Xcode. In the targets -> summary screen there is a setting for "Supported Device Orientations."
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
06/21/12 05:20 PM (13 years ago)
I've submitted 3 and had no problems (knock on wood). But I thought the article I put on iDevDepot had both solutions on there? http://idevdepot.com/ipad-screen-rotation-lock-for-ios-v1-5/ Halfway down, the part from Jackreeves. Is this what you were looking for?
 
magister
I hate code!
Profile
Posts: 66
Reg: Feb 16, 2012
firenze
660
like
06/21/12 09:46 PM (13 years ago)
Thanks a lot to MGoBlue and Stobe for taking the time to reply. The solution to 180 degree portrait only rotation, are all of the above mentioned ones with the caveat that BT_rotatingTabBarController.m middle line at the 3 related strings: //allow / dissallow rotations should read: if([appDelegate.rootApp.rootDevice isIPad]){ canRotate = FALSE; AND to save some time to the next person having this issue I will paste below what my Xcode 4.3.3 reads like: BT_rotatingNavController.m is: //allow / dissallow rotations BOOL canRotate = TRUE; //appDelegate butt2_appDelegate *appDelegate = (butt2_appDelegate *)[[UIApplication sharedApplication] delegate]; if([appDelegate.rootApp.rootDevice isIPad]){ canRotate = TRUE; }else{ //should we prevent rotations on small devices? if([appDelegate.rootApp.jsonVars objectForKey:@"allowRotation"]){ if([[appDelegate.rootApp.jsonVars objectForKey:@"allowRotation"] isEqualToString:@"largeDevicesOnly"]){ canRotate = FALSE; While the BT_rotatingTabBarController.m reads: //allow / dissallow rotations BOOL canRotate = TRUE; //appDelegate butt2_appDelegate *appDelegate = (butt2_appDelegate *)[[UIApplication sharedApplication] delegate]; if([appDelegate.rootApp.rootDevice isIPad]){ canRotate = FALSE; }else{ //should we prevent rotations on small devices? if([appDelegate.rootApp.jsonVars objectForKey:@"allowRotation"]){ if([[appDelegate.rootApp.jsonVars objectForKey:@"allowRotation"] isEqualToString:@"largeDevicesOnly"]){ canRotate = FALSE; ________________________________ That at least worked for me. Thanks again to this great community of developers.
 

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.