Xcode:获取警告“枚举类型的隐式转换UIDeviceOrientation”
全面警告:
Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation' 把它放在一起: [self orientationChanged:interfaceOrientation]; 这是方法: - (void)orientationChanged:(UIInterfaceOrientation)interfaceOrientation 我不知道这个警告来自哪里,我不是世界上最好的Xcoder,但我可以通过这个数字来确定。 任何帮助将不胜感激。 解决方法
UIDeviceOrientation是指设备的物理方向,而UIInterfaceOrientation是指用户界面的方向。当你打电话给你的方法
[self orientationChanged:interfaceOrientation]; 当您应该根据该方法使用UIInterfaceOrientation时,您最有可能传递一个UIDeviceOrientation。 只是为了扩展这一点,UIDeviceOrientation是UIDevice类的一个属性,并且有这些可能的值:
对于UIInterfaceOrientation,它是UIApplication的属性,只包含与状态栏方向对应的4种可能性: UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft 要获取UIDeviceOrientation,请使用 [[UIDevice currentDevice] orientation] 并获取UIInterfaceOrientation,您可以使用 [[UIApplication sharedApplication] statusBarOrientation] (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |