- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);}
//- (BOOL)shouldAutorotate
//{
// NSLog(@"让不让我旋转?");
// return YES;
//}
//
//- (NSUInteger)supportedInterfaceOrientations {
// NSLog(@"让我旋转哪些方向");
// return UIInterfaceOrientationMaskAllButUpsideDown;
//- (BOOL)shouldAutorotate
//{
// NSLog(@"让不让我旋转?");
// return YES;
//}
//
//- (NSUInteger)supportedInterfaceOrientations {
// NSLog(@"让我旋转哪些方向");
// return UIInterfaceOrientationMaskAllButUpsideDown;
//}
你可以复写viewcontroller的下面几个模板函数,试试。
- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);当前viewcontroller是否支持转屏
- (NSUInteger)supportedInterfaceOrientations;当前viewcontroller支持哪些转屏方向
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation当前viewcontroller默认的屏幕方向