Xcode:获取警告“枚举类型的隐式转换UIDeviceOrientation”

Xcode:获取警告“枚举类型的隐式转换UIDeviceOrientation”,第1张

概述全面警告: Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation' 把它放在一起: [self orientationChanged:interfaceOrientation]; 这是方法: - (void)orien 全面警告:

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类的一个属性,并且有这些可能的值:

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]
总结

以上是内存溢出为你收集整理的Xcode:获取警告“枚举类型的隐式转换UIDeviceOrientation”全部内容,希望文章能够帮你解决Xcode:获取警告“枚举类型的隐式转换UIDeviceOrientation”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1074182.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存