Beginning iOS Storyboarding with Xcode Easily Design and Develop Your App, from Concept and Vision to Code ■ ■ ■ Rory Lewis Yulia McCarthy Stephen M... Beginning iOS Storyboarding
Trang 1Beginning iOS Storyboarding with
Xcode
Easily Design and Develop Your App, from Concept
and Vision to Code
■ ■ ■
Rory Lewis
Yulia McCarthy
Stephen M Moraco
Trang 2Beginning iOS Storyboarding with Xcode
Copyright © 2012 by Rory Lewis, Yulia McCarthy, and Stephen M Moraco
All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher
ISBN-13 (pbk): 978-1-4302-4272-7
ISBN-13 (electronic): 978-1-4302-4273-4
Trademarked names, logos, and images may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in
an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject
to proprietary rights
President and Publisher: Paul Manning Lead Editor: Matthew Moodie
Technical Reviewer: Matthew Knott Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Morgan Ertel, Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Gwenan Spearing, Matt Wade, Tom Welsh
Coordinating Editor: Brigid Duffy Copy Editor: Corbin Collins Compositor: Bytheway Publishing Services Indexer: SPi Global
Artist: SPi Global Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com
For information on translations, please e-mail rights@apress.com, or visit www.apress.com
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales
The information in this book is distributed on an “as is” basis, without warranty Although every
precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly
or indirectly by the information contained in this work
The source code for this book is available to readers at www.apress.com
Trang 3To my mother, Adeline Thank you for those 13 hours! Love you
—Rory
To my amazing mom—the most caring and supportive person I’ve ever known
Thank you for your endless love!
—Yulia
To Donna, my wife of 31 years, my best friend and travelling companion through this life and around this beautiful planet Without your support and encouragement, many of my efforts throughout our time together would not have been possible, nor nearly as enjoyable I look
forward to our upcoming years together
To my son Steve, for sharing in our many endeavors together, for your graphics contribution to our first joint iOS app, 9CardGolf in the App Store, but most importantly for being a shining example to me, and I hope to others, of constant self-motivation and constant learning, and for maintaining a youthful passion for learning about the universe in which we live I look forward
to seeing where you go with your photography passion and the life ahead of you
—Stephen
Trang 4Contents at a Glance
■ Foreword: About the Authors viii
■ About the Contributing Author xii
■ About the Technical Reviewer xiii
■ Introduction xiv
■ Chapter 1: Preliminaries 1
■ Chapter 2: Fundamentals 27
■ Chapter 3: Storyboarding with MapView 91
■ Chapter 4: Building a Utility Application 159
■ Chapter 5: Storyboarding a Page-Based App 211
■ Chapter 6: Mastering Table Views with Storyboarding: Core Data… 273
■ Chapter 7: Mastering Table Views with Storyboarding: Designing… 305
■ Chapter 8: Mastering Table Views with Storyboarding: Coding… 383
■ Chapter 9: Single View ##: wanderBoard Part I… 477
■ Chapter 10: Single View #3: wanderBoard Part II 503
■ Chapter 11: Single View #3: wanderBoard Part III 569
■ Chapter 12: How Far You’ve Come 609
■ Index 613
Trang 5Contents
■ Foreword: About the Authors viii
■ About the Contributing Author xii
■ About the Technical Reviewer xiii
■ Introduction xiv
■ Chapter 1: Preliminaries 1
Necessities and Accessories 1
Getting a Mac 2
Getting OS X 4
Become a Developer 6
Getting Ready for Your First iPhone/iPad Project 17
Installing DemoMonkey 21
■ Chapter 2: Fundamentals 27
helloAlien: A Quick Example Application 35
Preliminaries 36
Step1: Create a Button That Segues to a Secondary View 38
Step 2: Pass Information Back from a Secondary View (Alien View) to the Main View 47
Step 3: Send Information Out to the Secondary View (Alien View) 70
Step 4: Custom Segue 83
■ Chapter 3: Storyboarding with MapView 91
flickrPhotoMap: A Single View App 92
Preliminaries 93
Step 1: Setting Up the Data Connection and Displaying Geotagged Photos on a Map 94
Trang 631 Navigate to DBAuthor.m Drag in the ‘‘09 DBAuthor.m Methods and Extra Properties Implementation’’ snippet from
DemoMonkey and place it between the last @dynamic and the
@end Also add #import "DBBook.h" right after the #import
"DBAuthor.h’’ as shown in Figure 6-30 and as follows:
#import "DBAuthor.h"
#import "DBBook.h"
That’s it! You’ve got through the setup and are ready to get on with designing the app using Storyboarding in Chapter 7