Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

9. Building and Using Controls > Building a Toolbar

Building a Toolbar

You can build toolbars in Interface Builder inside Xcode, but when push comes to shove, it’s often a lot easier coding items directly. That’s because the IB user interface for adding and customizing a toolbar’s bar button items is pretty dreadful. You need to keep switching between palettes and inspectors, and things quickly get messy.

After dragging a toolbar into an IB view, you must add and then customize each bar button item. Drag in one bar button item for each element you plan to add. Toolbar elements include view items such as buttons as well as the spacers that lie between those buttons, as shown in Figure 9-12 (left).

Image

Figure 9-12. Adding bar button items in Interface Builder can be a tedious process.

Once added, the bar button item attributes inspector shown in Figure 9-12 (right) lets you choose which kind of item each bar button represents. Use the Custom style to create custom text- and image-based items. Otherwise, pick from the list of system-defined icons. These include icons for playing media, accessing the camera, editing a list, and more.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint