我有以下代码,允许我将我的特定视图旋转到横向,但是一旦它转到横向,它将不会旋转回到肖像?任何帮助表示赞赏。
@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表示支持的方向 return YES; //(interfaceOrientation == UIInterfaceOrientationPortrait); }
Thanks for your help!
答案 0 :(得分:0)
试试这个shouldAutorotate方法:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}