Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation'
把它放在一起:
[self orientationChanged:interfaceOrientation];
这是方法:
- (void)orientationChanged:(UIInterfaceOrientation)interfaceOrientation
我不知道这个警告来自哪里,我不是世界上最好的Xcoder,但我可以通过这个数字来确定。
任何帮助将不胜感激。
解决方法
[self orientationChanged:interfaceOrientation];
当您应该根据该方法使用UIInterfaceOrientation时,您最有可能传递一个UIDeviceOrientation。
只是为了扩展这一点,UIDeviceOrientation是UIDevice类的一个属性,并且有这些可能的值:
UIDeviceOrientationUnknown
– Can’t be determined
UIDeviceOrientationPortrait
– Home button facing down
UIDeviceOrientationPortraitUpsideDown
– Home button facing up
UIDeviceOrientationLandscapeLeft
– Home button facing right
UIDeviceOrientationLandscapeRight
– Home button facing left
UIDeviceOrientationFaceUp
– Device is flat,with screen facing up
UIDeviceOrientationFaceDown
– Device is flat,with screen facing down
对于UIInterfaceOrientation,它是UIApplication的属性,只包含与状态栏方向对应的4种可能性:
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
要获取UIDeviceOrientation,请使用
[[UIDevice currentDevice] orientation]
并获取UIInterfaceOrientation,您可以使用
[[UIApplication sharedApplication] statusBarOrientation]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。