开发者

Tabcontroller problem?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜