Discussion Forums  >  Uncategorized

Replies: 5    Views: 457

icedbreeze
I hate code!
Profile
Posts: 123
Reg: Nov 09, 2010
London
1,230
03/14/11 12:46 PM (14 years ago)

Screen Orientation 'B00L' = 0, but still rotates?

Hi, I followed a previous guide on preventing an app from rotating when the iPhone is tilted. It worked to begin with, but since I have re-run my App from Xcode, my background became out of alignment and my screen rotates even when I have changed the settings... The code is as follows... @implementation BT_rotatingTabBarController ******* ROTATING TAB BAR CONTROLLER ****** //init -(id)init{ if (self = [super init]) { //[BT_debugger showIt:self:[NSString stringWithFormat:@INIT%@, @]]; } return self; } //should rotate -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { //[BT_debugger showIt:self:[NSString stringWithFormat:@shouldAutorotateToInterfaceOrientation %@, @]]; //ALWAYS ALLOWING ROTATIONS BOOL canRotate = 0; //can it rotate? if(canRotate == 0){ //[BT_debugger showIt:self:[NSString stringWithFormat:@can rotate: YES, @]]; return YES; }else{ //[BT_debugger showIt:self:[NSString stringWithFormat:@can rotate: NO, @]]; return (interfaceOrientation == UIInterfaceOrientationPortrait); } //we should not get here return YES; ****** ROTATING NAV CONTROLLER *******
 
icedbreeze
I hate code!
Profile
Posts: 123
Reg: Nov 09, 2010
London
1,230
like
03/14/11 12:47 PM (14 years ago)
*/ //ALWAYS ALLOWING ROTATIONS BOOL canRotate = 0; //can it rotate? if(canRotate == 0){ //[BT_debugger showIt:self:[NSString stringWithFormat:@can rotate: NO, @]]; return YES; }else{ //[BT_debugger showIt:self:[NSString stringWithFormat:@can rotate: YES, @]]; return (interfaceOrientation == UIInterfaceOrientationPortrait); } //we should not get here return YES;
 
icedbreeze
I hate code!
Profile
Posts: 123
Reg: Nov 09, 2010
London
1,230
like
03/14/11 12:48 PM (14 years ago)
Any idea where I might be going wrong? Many thanks. P.S Ive tested this both on Simulator and Device, both still orientate to Landscape when I am looking for a fixed Portrait view.
 
Irishaisle
Aspiring developer
Profile
Posts: 53
Reg: Nov 22, 2010
location unknow...
530
like
03/14/11 12:51 PM (14 years ago)
should be... if(canRotate == 1) keep ... BOOL canRotate = 0 Do same with navcontroller I think this will work. Same thing happened to me.
 
icedbreeze
I hate code!
Profile
Posts: 123
Reg: Nov 09, 2010
London
1,230
like
03/14/11 12:53 PM (14 years ago)
You are an absolute diamond thank you! :) Weird how it worked before with the above code, then reverted back to orientating. I'll never understand Xcode. But thank you for the help.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/14/11 01:29 PM (14 years ago)
We'll have a 'Allow Rotation' setting in the Core settings area of v1.5 apps eventually. @icedbreeze: You probably didn't do anything wrong. Little gotcha's like this creep in sometimes when we upload the project on the download server. It's possible that you re-downloaded something? The idea is that as our Early Adopter audience tweeks, discovers, fixes, complains.... we try to listen and get these things on the control panel. It's important that you can re-download your project over and over again without having to make your custom mods - this is one of them (rotation settings) for now.
 

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.