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.

CHAPTER 8: Data Management with Core Data 267The city and country fields will stretch to fill the width of their cells, but make the region field alittle narrower and place another text field (another duplicate will do) to its right to display thepostalCode property. Make this about 70 points wide and position it aligned to the right edge ofthe cell. Drag the region field’s right edge until it snaps into place next to the postal code field.Also ensure that the baselines of the two cells are correctly aligned.When resizing the interface, the postal code field should be able to grow, but it’s more importantthat the region field grow. To implement this, select the region field and open the Size Inspector.There are two items you will want to change there: the Content Hugging Priority and the ContentCompression Resistance Priority. The former defines how important it is that the view’s sizeremains tightly fixed around its contents’ size, while the latter defines how important it is that theview resists being made smaller than its content. For your purposes, you want the region field’scontent hugging priority to be a little lower than normal. This means that when the layout enginecalculates the positioning of items based on their constraints, it will be less important that theregion field should cling to its content size—it will be more acceptable to expand that field thanany others, such as the postal code field.Set the region field’s content hugging priority to 200, down from the default of 250. Now selectthe two-line Street field and pin its height; this will prevent it from shrinking down to a single linein height when being displayed, potentially throwing out the layout of the other fields.Ensure that all these fields’ behaviors are set to Editable, and bind their values appropriately:to their Table Cell View’s objectValue.street, objectValue.city, objectValue.region,objectValue.postalCode, and objectValue.country.If you launch the application now, you should be able to browse, add, remove, and editaddresses. The interface should look like Figure 8-12. Your application is complete!Figure 8-12. The Address viewer in actionSummaryIn this chapter I’ve covered the basics of what Core Data is and how it works, along with someof the techniques for managing different types of relational data models. You should now havea good idea how to go about implementing your data storage using Core Data, and really youshould—it’s fantastic, and it scales very very well.www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!