As an iOS developer you probably spend a lot of time in Interface Builder (IB) making your interfaces. IB has many features quietly tucked away that can help you be more efficient in xCode and help you create better apps. This article covers 6 helpful tips that I've discovered while using IB in Xcode 6. This list is not an exhaustive list, there may be others that I haven't discovered or some that I just take for granted.

1. Rename Objects

When you build a view structure even moderately complicated, the Document Outline view on the left side of the IB window quickly becomes overwhelming. You can help organize these views by renaming them to something more contextually relevant. If you select an object in the Document Outline view then click on it again (not a double click, that's too fast, instead a select, pause, click sequence) the component name becomes editable. You can then type a useful name and hit enter to save the new name. You can also select the item and press alt-enter to activate editing mode. The names that you give the components will show up in other views and constraints within IB so that you can easily tell which views are being referenced.

2. Rename Constraints

The short-cut for renaming objects also works for renaming constraints in the Document Outline view. If you're building an adaptive layout with 3 or 4 possible configurations you can end up with dozens of constraints. The normal constraint naming scheme used by IB quickly obscures the meaning of the constraints. I've found that using a naming convention where I prefix the constraint with an abbreviation of the target size class is helpful in organizing constraints. For example, a constraint in the compact-regular layout would be prefixed with CR and one in the any-any configuration would be AA.

3) Ctrl-Shift-Click Goodness

A common problem I've experienced when building an interface is that I need to overlay several views with a transparent layer to hold some views that may be hidden and revealed at runtime. These overlaying views tend to block the selection of views beneath them. If you Ctrl-Shift-Click anywhere in the view a context menu will appear that shows all of the views that are beneath that location in the view hierarchy, as shown in the figure below. You can then select any of those views from that menu to make it active. This simple trick can save many hours of time wasted on moving overlay views out of the way to select things beneath them, then forgetting to put them back. I learned this trick at Cocoaconf in a session taught by Sam Davies of Shinobi Controls.

4) Measurements on-demand

Designers often give developers UI specifications with the distance between items provided in ways that don't readily match how we add constraints to the views, so figuring out what the value of each constraint should be becomes complex. So instead, we run the app and use a tool like Scope to measure distances from the rendered screen. Using this helpful tool in IB, you can avoid the step of having to run the app to measure things. If you select a view in your structure then hold down the option key as you move the mouse around (remember to let go of the view before you start moving the mouse), IB will show the distance between the selected view and the view beneath the mouse pointer. In the first figure below, the mouse pointer is over the button's parent view, so it gives the buttons' locations within the superview. In the second figure below, the mouse pointer is over the label so IB shows the distances (X and Y) between the button and the label.

5) Extend IB

I wrote about this several months back,, but I want to re-iterate that adding IB_Designable categories to your project makes IB extremely useful for your specific development tasks. The gist of the article is that you can annotate almost any property of an object with IBInspectable to make that property controllable in IB. So, if you are re-using a view controller in several places and would like to customize some property values per use, annotate that property with IBInspectable so that you can set the values at design-time rather than adding more code to viewDidLoad.

6) Identify Constraints and views for debugging

Using the ability mentioned in item #5, add categories to your project to extend NSLayoutConstraint and UIView. To the NSLayoutConstraint extension add an IBInspectable property setter to set the value of ‘identifier'. When that property is set on a NSLayoutConstraint and that constraint is involved in a constraint conflict, the debug dump will contain the identifier that you provided. This will help you quickly identify the constraints involved in the conflict. Likewise, a category on UIView that sets the accessibilityIdentifier value will cause the names you provide as accessibilityIdentifier to be used in the conflict debug dump.