开发者

Tabcontroller problem?

开发者 https://www.devze.com 2022-12-09 02:46 出处:网络
How can i rotate tabbarcontroller in landscape modewhen i am having XIB file(tab bar controller) in portait.i wrote the follwing in appdelegate

How can i rotate tabbarcontroller in landscape mode when i am having XIB file(tab bar controller) in portait.i wrote the follwing in appdelegate

    开发者_开发百科
  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } , but it wont be rotated any help please?


AS i remember, you cannot rotate the SDK's UITabBar controller. You chold make your own tabbar, inherint it from UITabBar and there return YES in shouldAutoRotate method.

#import <UIKit/UIKit.h>    
  @interface MainTabBarController : UITabBarController{
  }    
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end  

this is an .h file

#import "MainTabBarController.h"
@implementation MainTabBarController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return YES;
} 
@end

You just have to change class of your tabbar from UITabBarController to MainTabBarController

0

精彩评论

暂无评论...
验证码 换一张
取 消