Pages

Subscribe:

Labels

Sep 6, 2010

Dynamic UITabBarController and UINavigationController Autorotate


The sample bellow describes the creation of a application with dynamic UITabBarController that autorotates also with UITabBar, UINavigationBar.
For a easy implemetation of auto rotation follow the instructions bellow-

You must have declared UITabBarController into your delegate, right?
So now you need to over right that.

make a new class named- UITabBarController

code for UITabBarController.h-
#import <UIKit/UIKit.h>
@interface UITabBarController (rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end


code for UITabBarController.m->
#import "UITabBarController.h"
@implementation UITabBarController (rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}
@end

Once these two files are added to your project, UITabBarController will be automatically overridden and the feature of auto rotation will work. Here you may download the sample code.


You may get Blog Post Alert on your cell phone via SMS. Subscribe to iphoneSampleCodes with your google account.

Indian users may subscribe via sms. Send ON iphonesamplecodes to 9870807070

No comments:

Post a Comment