UI_APPEARANCE_SELECTOR Markers Have Unclear/Inconsistent Meaning
| Originator: | kristopherdjohnson | ||
| Number: | rdar://13711241 | Date Originated: | 22-Apr-2013 07:34 PM |
| Status: | Duplicate/8922060 | Resolved: | |
| Product: | iPhone SDK | Product Version: | 6.1 |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
The documentation for the UIAppearance protocol states "To support appearance customization, a class must conform to the UIAppearanceContainer protocol and relevant accessor methods must be marked with UI_APPEARANCE_SELECTOR."
However, several properties of UIView, UIButton, and UILabel seem to support customization despite the lack of a UI_APPEARANCE_SELECTOR marker. It is strange that these widely used classes do not officially support this powerful customization mechanism, even though it seems to work fine when developers use it. This leads some developers to assume that markers were inadvertently left out in many cases.
The documentation should be updated to clearly indicate the consequences of trying to customize properties that are not marked as customizable, and the customization mechanism should ignore attempts to customize properties that are not officially supported, to avoid accidental reliance on unsupported behavior.
Steps to Reproduce:
1. Create a new iOS application project, using the Single View Application template.
2. Run the generated app in the simulator. Note that it displays a white background by default.
3. Add this line to the top of the -application:didFinishLaunchingWithOptions: method:
[[UIView appearance] setBackgroundColor:[UIColor blueColor]];
4. Run the app again. Note that the background color is now blue, although the backgroundColor property is not marked with UI_APPEARANCE_SELECTOR in the UIView class declaration.
Expected Results:
Attempts to use the customization mechanism with unsupported properties should have no effect or at least elicit a warning message.
Actual Results:
The presence or absence of UI_APPEARANCE_SELECTOR seems to have no effect on customization behavior.
Regression: N/A
Notes: N/A
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!