iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and...

7
Extracted from: iOS SDK Development This PDF file contains pages extracted from iOS SDK Development, published by the Pragmatic Bookshelf. For more information or to purchase a paperback or PDF copy, please visit http://www.pragprog.com. Note: This extract contains some colored text (particularly in code listing). This is available only in online versions of the books. The printed versions are black and white. Pagination might vary between the online and printer versions; the content is otherwise identical. Copyright © 2012 The Pragmatic Programmers, LLC. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina

Transcript of iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and...

Page 1: iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and the iPhone 5 ? 2.6 The iOS Programming Stack ? 2.7 Building Views with UIKit ? 2.8

Extracted from:

iOS SDK Development

This PDF file contains pages extracted from iOS SDK Development, published bythe Pragmatic Bookshelf. For more information or to purchase a paperback or

PDF copy, please visit http://www.pragprog.com.

Note: This extract contains some colored text (particularly in code listing). Thisis available only in online versions of the books. The printed versions are blackand white. Pagination might vary between the online and printer versions; the

content is otherwise identical.

Copyright © 2012 The Pragmatic Programmers, LLC.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted,in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise,

without the prior consent of the publisher.

The Pragmatic BookshelfDallas, Texas • Raleigh, North Carolina

Page 2: iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and the iPhone 5 ? 2.6 The iOS Programming Stack ? 2.7 Building Views with UIKit ? 2.8
Page 3: iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and the iPhone 5 ? 2.6 The iOS Programming Stack ? 2.7 Building Views with UIKit ? 2.8

iOS SDK Development

Chris AdamsonBill Dudney

The Pragmatic BookshelfDallas, Texas • Raleigh, North Carolina

Page 4: iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and the iPhone 5 ? 2.6 The iOS Programming Stack ? 2.7 Building Views with UIKit ? 2.8

Many of the designations used by manufacturers and sellers to distinguish their productsare claimed as trademarks. Where those designations appear in this book, and The PragmaticProgrammers, LLC was aware of a trademark claim, the designations have been printed ininitial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer,Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trade-marks of The Pragmatic Programmers, LLC.

Every precaution was taken in the preparation of this book. However, the publisher assumesno responsibility for errors or omissions, or for damages that may result from the use ofinformation (including program listings) contained herein.

Our Pragmatic courses, workshops, and other products can help you and your team createbetter software and have more fun. For more information, as well as the latest Pragmatictitles, please visit us at http://pragprog.com.

The team that produced this book includes:

Brian P. Hogan (editor)Potomac Indexing, LLC (indexer)Molly McBeath (copyeditor)David J Kelly (typesetter)Janet Furlow (producer)Juliet Benda (rights)Ellie Callahan (support)

Copyright © 2012 The Pragmatic Programmers, LLC.All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, ortransmitted, in any form, or by any means, electronic, mechanical, photocopying,recording, or otherwise, without the prior consent of the publisher.

Printed in the United States of America.ISBN-13: 978-1-934356-94-4Encoded using the finest acid-free high-entropy binary digits.Book version: P1.0—November 2012

Page 5: iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and the iPhone 5 ? 2.6 The iOS Programming Stack ? 2.7 Building Views with UIKit ? 2.8

Contents

Acknowledgments . . . . . . . . . . . ?

Introduction . . . . . . . . . . . . . ?

1. Tweetings and Welcome to iOS 6 . . . . . . . . ?Tooling Up ?1.1

1.2 Our First Project ?1.3 Building Our User Interface ?1.4 Coding the App ?1.5 Tweet, Sweet Success ?

2. Programming for iOS . . . . . . . . . . . ?Introducing Objective-C ?2.1

2.2 Methods and Messaging ?2.3 Memory Management ?2.4 Managing an Object’s Properties ?2.5 Auto Layout and the iPhone 5 ?2.6 The iOS Programming Stack ?2.7 Building Views with UIKit ?2.8 Using the Foundation Classes ?2.9 Internationalization ?2.10 Wrap-Up ?

3. Asynchronicity and Concurrency . . . . . . . . ?Encapsulating Concurrent Code with Blocks ?3.1

3.2 Grand Central Dispatch ?3.3 Concurrency and UIKit ?3.4 Sorting with Blocks ?3.5 Wrap-Up ?

Page 6: iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and the iPhone 5 ? 2.6 The iOS Programming Stack ? 2.7 Building Views with UIKit ? 2.8

4. View Controllers . . . . . . . . . . . . ?Practicing MVC ?4.1

4.2 Working with a View’s Life Cycle ?4.3 Building a Detailed Recipe View ?4.4 Wrap-Up ?

5. Table Views . . . . . . . . . . . . . ?The UITableView ?5.1

5.2 Displaying a List of Recipes ?5.3 Editing a Table ?5.4 Working with Cell Styles ?5.5 Recipe Details ?5.6 Wrap-Up ?

6. Storyboards and Container Controllers . . . . . . ?Laying Out Storyboards ?6.1

6.2 Using Container Controllers ?6.3 Moving Around with Navigation Controllers ?6.4 Managing View Controllers in Navigation Controllers ?6.5 Transferring App Control and Data ?6.6 Returning App Control and Data ?6.7 Wrap-Up ?

7. Documents and iCloud . . . . . . . . . . ?Making Recipes Persist ?7.1

7.2 Telling the Recipe Document About Edits ?7.3 Sharing Recipes ?7.4 Opening Shared Recipe Documents ?7.5 Storing Documents in iCloud ?7.6 Wrap-Up ?

8. Drawing and Animating . . . . . . . . . . ?Drawing Images ?8.1

8.2 Drawing Paths ?8.3 Using Shadows ?8.4 Rotating and Animating Images ?8.5 Drawing Shadows ?8.6 Wrap-Up ?

9. Testing and Fixing Apps . . . . . . . . . . ?Unit Testing ?9.1

9.2 Debugging Our App ?

Contents • vi

Page 7: iOS SDK Development - Pragmatic Bookshelfmedia.pragprog.com/titles/adios/toc.pdf2.5 Auto Layout and the iPhone 5 ? 2.6 The iOS Programming Stack ? 2.7 Building Views with UIKit ? 2.8

9.3 User Interface Testing ?9.4 Testing Performance with Instruments ?9.5 Wrap-Up ?

10. The App Store and Beyond . . . . . . . . . ?Protecting Our Code with Source Control ?10.1

10.2 Running on the Device ?10.3 Submitting Apps for Review ?10.4 After We Ship ?10.5 Onward! ?

A1. Wait! I Forgot (or Never Learned) C! . . . . . . . ?A1.1 C: The Basics ?A1.2 Pointers ?A1.3 Dynamic Memory Management ?

Bibliography . . . . . . . . . . . . . ?

Index . . . . . . . . . . . . . . . ?

Contents • vii