UIBarButtonItem Invisible in Interface Builder

Originator:justatheory
Number:rdar://11234043 Date Originated:11-Apr-2012 09:35 PM
Status:Open Resolved:
Product:Developer Tools Product Version:4.3.2 (4E2002)
Classification:UI/Usability Reproducible:Always
 
Summary:

When you drag a UIBarButtonItem into the content area of Interface Builder -- that is, with no parent view, not even a UIToolbar -- it's properly listed under "Objects" in the left pane, but completely invisible in the content area -- where views are normally displayed.

Steps to Reproduce:

1. Create a new Master–Detail application.
2. Select DetailViewController.xib in the navigator.
3. Drag a "Bar Button Item" from the object browser to the grid paper area of the content area. Do not drop it onto any other view.
4. Try to find it in the content area.

Expected Results:

The bar button item should be visible in the content area.

Actual Results:

The bar button item is not visible anywhere in the content area. As far as I can tell, it cannot be selected there or clicked on, except by hitting cmd-a to select all. It *is* visible in the list of objects in the left pane, and one can adjust its properties there, but one cannot see what it actually looks like.

Regression:

Unknown.

Notes:

I've attached a sample project demonstrating the issue. Open it in Xcode 4.3.2 and navigate to the DetailViewController.nib. Note that the list of objects includes one Bar Button Item inside the UIToolbar in the view, and one Bar Button Item with no parent view. Only the former is visible in the content area; the latter is not.

You might ask, fairly, why I'd want to do something like this. Well, I want to give my designer control over the look and order of bar button items that appear in the toolbar when a view is loaded into a UINavigationController. So I add this line to the views .h file:

    @property (nonatomic, strong) IBOutletCollection(UIBarButtonItem) NSArray *toolbarItems;

And then the designer can create bar button items and assign them all to the toolbarItems property, and they will magically appear in the toolbar when the view is pushed onto a UINavigationController. But they can't be in a toolbar in the nib, or else it appears in the view, so there are two. (I guess it could be outside of the view, but it just seems wasteful to have it at all, since it's not used.)

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!