Question

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.

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.

So I have a few questions:

  • 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)?
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top