UIKit: Using UIAppearance with UIBarButtonItem subclasses results in exception
| Originator: | adrian.kashivskyy | ||
| Number: | rdar://14722948 | Date Originated: | 13-Aug-2013 02:16 PM |
| Status: | Open | Resolved: | No |
| Product: | iOS SDK | Product Version: | iOS 7.0 SDK |
| Classification: | Other Bug | Reproducible: | Always |
Summary: Using UIAppearance proxy with UIBarButtonItem subclasses is causing an unrecognized selector being sent to UINavigationButton. Steps to Reproduce: 1. Create a simple app with UINavigationController with one child view controller 2. Create a new subclass of UIBarButtonItem 3. Create a new property tagged with UI_APPEARANCE_SELECTOR 4. Set this property using appearance proxy in e.g. App Delegate 5. In your view controller set self.navigationItem.rightBarButtonItem = <your button>; 6. Run the application Alternatively, you can open my attached demo project and run it. Expected Results: The property is being set correctly by UIAppearance. Actual Results: An "unrecognized selector sent to instance" exception (NSInvalidArgumentException) is raised, sending a property setter message to UINavigationButton Regression: This behavior may be caused because of UIBarButtonItem inheritance. UIBarButtonItem inherits from NSObject, not UIView and it uses a custom appearance class (_UIBarButtonAppearance). Its forwardInvocation: method may be forwarding the property setter to UINavigationButton, not the UIBarButtonItem itself. Notes: This behavior is present only if you initialize your UIBarButtonItem subclass with all methods except initWithCustomView:, because initWithCustomView: does not create a UINavigationButton. --- 13-Aug-2013 02:16 PM 'UIBarButtonItem Subclass Demo.zip' was successfully uploaded
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!
Attachments
http://cl.ly/2f0K2q0o312k/download/rdar-14722948.zip