right/leftBarButtonItems should return an empty array instead of nil if not set

Originator:gordon
Number:rdar://15693343 Date Originated:18-Dec-2013 05:37 PM
Status:Open Resolved:
Product:iOS SDK Product Version:7.0
Classification:Enhancement Reproducible:Always
 
Summary:
It would reduce a bunch of existence checking if we could just assume that the `rightBarButtonItems` and `leftBarButtonItems` properties on UINavigationItem would return an empty array instead of nil when not set. As it stands, if I want to dynamically add a button item, I have to get the bar button items, check for nil, create a new array if it is, then add the item to a mutable copy.

Steps to Reproduce:
Create a UIViewController and add a UINavigationItem (Possibly by wrapping it in a UINavigationController)

Expected Results:
self.navigationItem.rightBarButtonItems returns an empty array

Actual Results:
self.navigationItem.rightBarButtonItems returns nil

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!