UIInterface Orientation Issue
I have the following code which allows me to rota开发者_Go百科te my specific view to landscape, however once it goes to landscape it will not rotate back to portrait? Any help is appreciated.
@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;
}
//Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return YES;//(interfaceOrientation == UIInterfaceOrientationPortrait); }
Thanks for your help!
Try this shouldAutorotate method :
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
精彩评论