05.01.2013 Views

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

468<br />

CHAPTER 25 MAC <strong>OS</strong> X DEVELOPMENT: THE TOOLS<br />

Navigation<br />

Though they’re easy to miss, there are several navigation aids along the top of any editor view<br />

(shown in Figure 25-16). These make it easy to move between different areas of a file, or even<br />

between files.<br />

Figure 25-16. Navigation controls on the top of Xcode’s editor<br />

On the left side there are back and forward buttons, a history menu, which lets you jump<br />

between recently edited files, and a function menu. The function menu lists any function,<br />

method, or class declarations, as well as defines, typedefs, and pragmas. Selecting an item from<br />

the function menu jumps to that item on the page.<br />

You can add navigation aids to your page, which will then show up in the function menu.<br />

Perhaps the most common is the mark pragma:<br />

#pragma mark This is some text.<br />

This will cause any text after mark to show up in the navigation menu, like so:<br />

This is some text.<br />

As with anything else, you can jump to the mark by selecting it. If you group your methods<br />

by functionality, marks are a great way to add subheadings to set off the sections. You can also<br />

use the mark pragma to add separators to the menu.<br />

#pragma mark -<br />

You can add comments to the function menu by beginning them with certain special prefixes.<br />

These prefixes and some examples of their use are listed in Table 25-1.<br />

Table 25-1. Xcode’s Special Comment Prefixes<br />

Prefix Example Result<br />

//???: //???: Is this really necessary? ???: Is this really necessary?<br />

//!!!: //!!!: This crashes every 3rd time !!!: This crashes every 3rd time<br />

//TODO: //TODO: Implement the edge case TODO: Implement the edge case<br />

//FIXME: //FIXME: The image no longer shows FIXME: The image no longer shows<br />

The editor’s upper right has several small buttons. These reveal menus for jumping to bookmarks,<br />

breakpoints, includes, and other files that define the current class, including superclasses,<br />

subclasses, and categories. There is also a button to jump between the current class’s header and<br />

implementation files.<br />

TIP You can jump between a class’s header and implementation files by typing<br />

Option+Cmd+up arrow.<br />

In the upper-right corner, there is a small lock icon. Clicking this icon will lock (or unlock)<br />

the current file, preventing accidental edits. Below the lock is a button that will horizontally split<br />

the editor into two independent views of the same file. Halves can be further split, and the split<br />

can be adjusted by dragging the divider. When an editor is split, a button will appear for rejoining<br />

the two halves.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!