UIButton和Appearance API-是否受支持? [英] UIButton and Appearance API - supported or not?

查看:133
本文介绍了UIButton和Appearance API-是否受支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 UIAppearance协议参考类需要符合 UIAppearanceContainer 支持标有 UI_APPEARANCE_SELECTOR 的方法,以便外观代理正常工作。在WWDC 2011的苹果自己的教学视频自定义UIControl的外观 中,

According to the UIAppearance protocol reference a class need to conform to the UIAppearanceContainer and have supported methods marked with UI_APPEARANCE_SELECTOR in order for the appearance proxy to work properly. In Apples own instruction video from WWDC 2011, "Customizing the appearance of UIControls", they provide examples where they use, and discuss, both UIButton and UILabel.

这两个类(通过从UIView继承)都符合UIAppearance和UIAppaeranceContainer协议,但没有一个具有标有 UI_APPEARANCE_SELECTOR 的方法。虽然确实可以用,但是我的钱花在了苹果上并没有得到苹果的完全支持,为什么在它们上使用外观代理会不安全。

Both of these classes conform (via inheritance from UIView) to the UIAppearance and UIAppaeranceContainer Protocols, but none of them have methods marked with UI_APPEARANCE_SELECTOR. The do work though, but my cents are spent on them not being fully supported by Apple, why it would be unsafe to use the appearance proxy on them.

所以我有一些问题:


  • 我是否错过了使UIButton / UILabel符合UIAppearance代理先决条件的要求?

  • 您会认为与UIAppearance代理一起使用它们是不安全的吗?

  • 如果事实证明这两个类都不在生产中使用外观代理,那么您将在哪个对象上使用外观代理?符合(显然,答案当然是任何使用 UI_APPEARANCE_SELECTOR 标记其方法并符合UIAppearance协议的对象)?

  • Have I missed something that makes UIButton/UILabel conform to the UIAppearance proxy prerequisites?
  • Would you argue that they are unsafe to use with the UIAppearance proxy?
  • On what object would you use the appearance proxy in production, if it turns out that these two classes don't conform (the obvious answer being, of course, any object that mark their methods with UI_APPEARANCE_SELECTOR and conform to the UIAppearance protocols)?

推荐答案

似乎有人提交了有关此问题的雷达,但他提到尝试通过外观代理使用方法时会抛出异常。他们为我工作,我同意WWDC会话中的引用使某人可能忘记了对标头进行注释。

It looks like someone has filed a radar on this issue, but he mentioned having exceptions thrown when attempting to use methods through appearance proxy. They worked for me, and I agree that the references in the WWDC session makes it likely that someone just forgot to annotate the header.

这篇关于UIButton和Appearance API-是否受支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆