我正在使用最新的 SDK 开发一个 iOS 应用程序。
我已将横向正确方向设置为可用的唯一方向,并且我对 viewController 视图有疑问。
这是我的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(deviceOrientationDidChange:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != AVCaptureVideoOrientationLandscapeRight);
}
- (void)deviceOrientationDidChange:(NSNotification*)notification
{
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (orientation == AVCaptureVideoOrientationLandscapeLeft)
NSLog(@"Orientation: Landscape Left");
else if (orientation == AVCaptureVideoOrientationLandscapeRight)
NSLog(@"Orientation: Landscape Right");
NSLog(@"FRAME: %@", NSStringFromCGRect(self.view.frame));
}
这是我得到的日志:
Orientation: Landscape Right
FRAME: {{0, 0}, {320, 568}}
Orientation: Landscape Right
FRAME: {{0, 0}, {320, 568}}
我的问题是关于{{0, 0}, {320, 568}}
:
为什么我会得到这些值?
我认为正确的值是{{0, 0}, {568, 320}}
.