检查UIAppearance的可用性(Checking for availability of UIAppearance)

编程入门 行业动态 更新时间:2024-10-20 11:53:44
检查UIAppearance的可用性(Checking for availability of UIAppearance)

我正在尝试使用以下命令来检查UIAppearance类的可用性:

NSClassFromString(@"UIAppearance")

然而这从iOS4和iOS5返回零 - 任何人都有关于如何解决这个问题的提示?

I'm trying to check for the availability of the UIAppearance class using:

NSClassFromString(@"UIAppearance")

However this returns nil from both iOS4 and iOS5 - anyone got any tips on how to work around this?

最满意答案

UIAppearance不是一个类,它是一个协议。 所以为了检查它是否存在,你可以使用:

NSProtocolFromString(@"UIAppearance");

它在<iOS5上返回null,但是在iOS5上返回一个对象。

UIAppearance is not a class, it is a protocol. So in order to check wether it exists or not, you would use:

NSProtocolFromString(@"UIAppearance");

It returns null on < iOS5, but an object on iOS5.

更多推荐

本文发布于:2023-04-29 13:10:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336331.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可用性   UIAppearance   availability   Checking

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!