[UINavigationItem setBackBarButtonItem:] is ignored if created with custom view
| Originator: | jeremyfoo | ||
| Number: | rdar://11361270 | Date Originated: | 02-May-2012 01:42 PM |
| Status: | Closed | Resolved: | NO |
| Product: | iPhone SDK | Product Version: | 5.1 |
| Classification: | Other Bug | Reproducible: | ALWAYS |
Summary: UIBarButtonItem is ignored by -[UINavigationItem setBackBarButtonItem:] in case it was initialized with custom view. Default value with title of previous UINavigationItem is used instead. Steps to Reproduce: 1. Create a viewController. 2. Set self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:[UIButton buttonWithType:UIButtonTypeRoundedRect]] autorelease]; 3. Push a new view controller onto the navigation stack. Expected Results: After pushing second view controller back bar button item must be rounded UIButton Actual Results: After pushing second view controller back bar button item is set to default with title of a previous view controller Regression: I noticed this for iOS 4.2/4.3 but searching on the Internet shows me that this issues exists since 2.0 SDK Notes: You can workaround it by setting leftBarButtonItem in second view controller (but have to set your own actions and targets, which is extremely cumbersome. You also lose the nice slide animation of the backButton coming from the right).
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!