Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 26, 2009, 03:07 PM   #1
RexInTheCity
macrumors newbie
 
Join Date: Jun 2008
TabBar Won't Rotate

I followed these instructions to make the app open in landscape mode, http://dejoware.com/blogpages/files/..._tutorial.html







But as you can see the tab bar does not want to rotate into landscape mode. Does anyone know how to solve this issue?
RexInTheCity is offline   0 Reply With Quote
Old Feb 27, 2009, 07:45 AM   #2
chbeer
macrumors member
 
Join Date: Sep 2008
Location: Berlin
Are you sure your app was realy rotated? maybe add an image or something to see, if the content of the view realy get's rotated.

My idea would be that you prevent your view from getting rotated. (there is a method for that, I can't remember the name and don't have access to the documentation).
__________________
Learn vocabulary on-the-go? iVocabulary!

Follow iVocabulary on Twitter!
chbeer is offline   0 Reply With Quote
Old Feb 27, 2009, 09:58 AM   #3
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Sounds like I may need to do a follow-up tutorial...
dejo is offline   0 Reply With Quote
Old Feb 27, 2009, 12:14 PM   #4
RexInTheCity
Thread Starter
macrumors newbie
 
Join Date: Jun 2008
chbeer, you are right about the app not rotating at all.

This is the only code I have done so far.

Code:
#import <UIKit/UIKit.h>

@class ViewController;

@interface AppDelegate : NSObject <UIApplicationDelegate> {
    IBOutlet UIWindow *window;
	IBOutlet UITabBarController *rootController;
}

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) UITabBarController *rootController;

@end
Code:
#import "AppDelegate.h"

@implementation AppDelegate

@synthesize window;
@synthesize rootController;


- (void)applicationDidFinishLaunching:(UIApplication *)application {    
	[window addSubview:rootController.view];
	[window makeKeyAndVisible];
	
	[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
}


- (void)dealloc {
	[rootController release];
    [window release];
	[super dealloc];
}

@end
Code:
#import "ViewController.h"


@implementation ViewController

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
    // Release anything that's not essential, such as cached data
}


- (void)dealloc {
    [super dealloc];
}

@end
RexInTheCity is offline   0 Reply With Quote
Old Feb 27, 2009, 03:26 PM   #5
LTX
macrumors regular
 
Join Date: Dec 2008
Location: Vancouver, BC, Canada
I am brand new to iPhone programming, but I've done a few apps from my book, so I may know how to fix it. From what I can tell, it looks like you aren't supporting the landscape left orientation, as in the following code:

Code:
@implementation ViewController

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Try changing the last line to the following, or simply rotating the simulator the other way:

Code:
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
Or I could be completely wrong.

If that doesn't work, I'll be back in a bit, and I'll see what the book had to say about the rotating view app.
__________________
13" Macbook Pro 2.26GHz, 2GB, 80GB Intel X25-M G2, 9400M
2nd gen iPod Touch 16GB
LTX is offline   0 Reply With Quote
Old Feb 27, 2009, 04:45 PM   #6
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Yeah, RexInTheCity, if you didn't change shouldAutorotateToInterfaceOrientation:, you haven't followed my entire tutorial.

EDIT: OK, Tab Bar apps are trickier. They doesn't seem to respond to the techniques from my tutorial. I'm still looking into it...

Last edited by dejo; Feb 27, 2009 at 05:31 PM.
dejo is offline   0 Reply With Quote
Old Feb 27, 2009, 08:28 PM   #7
RexInTheCity
Thread Starter
macrumors newbie
 
Join Date: Jun 2008
Adding left doesn't change anything and I only want it on LandscapeRight anyways.
RexInTheCity is offline   0 Reply With Quote
Old Mar 3, 2009, 07:36 PM   #8
RexInTheCity
Thread Starter
macrumors newbie
 
Join Date: Jun 2008
Dejo, I don't suppose you've found anything? I still haven't gotten anywhere
RexInTheCity is offline   0 Reply With Quote
Old Mar 3, 2009, 08:00 PM   #9
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by RexInTheCity View Post
Dejo, I don't suppose you've found anything? I still haven't gotten anywhere
All I found was this: Auto-rotating Tab Bars on the iPhone

Haven't had a chance to check it out yet.
dejo is offline   0 Reply With Quote
Old Mar 4, 2009, 01:37 PM   #10
North Bronson
macrumors 6502
 
Join Date: Oct 2007
Location: Los Angeles
For what it's worth, I made a Custom Tab Bar Controller class (CustomTabBarController), over-rode shouldAutorotateToInterfaceOrientation for this class, and it worked.

The documentation says that Tab Bar Controller is not meant to be subclassed; so I guess it's not entirely Kosher.
__________________
North Bronson Software
North Bronson is offline   0 Reply With Quote
Old Mar 6, 2009, 01:55 AM   #11
RexInTheCity
Thread Starter
macrumors newbie
 
Join Date: Jun 2008
Quote:
Originally Posted by BruinEcon08 View Post
For what it's worth, I made a Custom Tab Bar Controller class (CustomTabBarController), over-rode shouldAutorotateToInterfaceOrientation for this class, and it worked.

The documentation says that Tab Bar Controller is not meant to be subclassed; so I guess it's not entirely Kosher.
Thanks Bruin, it worked perfectly.

Does anyone know of any side effects of subclassing a tab bar controller since Apple doesn't suggest it?
RexInTheCity is offline   0 Reply With Quote
Old Mar 6, 2009, 04:39 PM   #12
North Bronson
macrumors 6502
 
Join Date: Oct 2007
Location: Los Angeles
Quote:
Originally Posted by RexInTheCity View Post
Does anyone know of any side effects of subclassing a tab bar controller since Apple doesn't suggest it?
Goons. Hired goons.
__________________
North Bronson Software
North Bronson is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
rotate screen option? iWeekend MacBook Pro 0 Oct 28, 2013 12:46 AM
Resolved: Video won't rotate to landscap in iOS 6 straber iPhone/iPad Programming 4 May 2, 2013 03:46 PM
iPhone Screen won't rotate in new Facebook app (merged) tiggilee iPhone and iPod touch Apps 54 Jan 25, 2013 07:17 PM
iPhone 5 Screen Won't Rotate kayemill iPhone 6 Oct 2, 2012 10:17 AM
Resolved: TabBar item selection Nnavick iPhone/iPad Programming 5 Jun 11, 2012 02:59 PM

Forum Jump

All times are GMT -5. The time now is 03:31 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC