shouldAutorotateToInterfaceOrientation这个是是否支持屏幕旋转的。如果return YES,那就是支持4个屏幕方向的。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
如果返回的是(interfaceOrientation == UIInterfaceOrientationPortrait)表示只支持home键在最下面的那个方向
((interfaceOrientation == UIInterfaceOrientation) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft))表示支持home键在下面和在左边的两个方向,以此类推......
typedef NS_ENUM(NSInteger, UIInterfaceOrientation) {
UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
};