2010-11-15 68 views
0

我有下面的代码,它允许我将我的特定视图旋转到风景,但是一旦它转到风景,它将不会旋转回肖像?任何帮助表示赞赏。UIInterface方向问题

@implementation SubMenusViewController 
@synthesize subMenusView; 
@synthesize mainMenuData; 

// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. 
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { 
     // Custom initialization 
    subMenusView=[[SubMenusView alloc] initWithFrame:[UISettings rectOfFullScreen:UIInterfaceOrientationPortrait]]; 
    } 
    return self; 
} 

//覆盖以允许默认纵向方向以外的方向。 (BOOL)shouldAutorotateToInterfaceOrientation :(UIInterfaceOrientation)interfaceOrientation { //对于支持的方向,返回YES; 返回YES; //(interfaceOrientation == UIInterfaceOrientationPortrait); }

Thanks for your help! 
+0

我的道歉,我离开了这部分; //覆盖以允许默认纵向方向以外的方向。 (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {//支持方向返回YES \t返回YES; //(interfaceOrientation == UIInterfaceOrientationPortrait); } – James 2010-11-15 23:53:28

回答

0

试试这个方法shouldAutorotate:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return YES; 
}