因为ios sdk更新后接口变化的问题,ios6前后的版本需要实现不同的旋转控制方法,如果兼容ios6前后的版本,则两种方法都需要实现。
ios6之前实现如下方法
// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsPortrait( interfaceOrientation );
}
ios6及以后实现如下方法
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskAllButUpsideDown;
#endif
}
- (BOOL) shouldAutorotate {
return YES;
}