13.07.2015 Views

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

348CHAPTER 9: Writing an Application[person setValue: result forKey: @"addresses"];[person setValue: @NO forKey: @"loadingAddresses"];});}];}];}// the completion block runs when the operation is complete or canceled__weak NSOperation * weakOp = op;[op setCompletionBlock: ^{if ( [weakOp isCancelled] )[person setValue: @NO forKey: @"loadingAddresses"];}];[_loaderQ addOperation: op];…and just like that, you’ve finished all the code for this application!InterfacingOpen APRemoteAddressBookWindowController.xib and delete its window. Nowopen MainMenu.xib, select the window, and copy it by pressing ⌘-C. Go back toAPRemoteAddressBookWindowController.xib and paste it using ⌘-V. Your user interface is 90%complete. That was easy, wasn’t it?Mostly you need to hook up the relevant bindings to the user interface elements, but first youmust resize things slightly to add some progress indicators. You place one at the bottom ofthe window below the People list, and one inside each pane of the tab view for their respectiveAddress lists.First, select the split view and drag its bottom edge upwards a little way—leave plenty of room atthe bottom of the window. Open the Object Palette and locate the Circular Progress Indicator; dragone into the bottom-left corner of the window, letting the guides snap it into place relative to thewindow’s bottom and left edges.Now find a Label and drag it alongside the progress indicator. Its bottom edge should align withthe progress indicator’s bottom edge, and it should snap into place to the progress indicator’sright. Set its text to “Fetching People…”—remember that you can type the ellipsis character using⌥-; (Option-semicolon).Select the progress indicator. In the Attributes Inspector, ensure the “Display When Stopped”checkbox is unchecked. Select the label and use the Attributes Inspector to set its Text Color toDisabled Control Text Color.Now drag the bottom edge of the split view back down until it snaps into place above theprogress indicator. The auto-layout struts should appear like those in Figure 9-6.www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!