Beginning iPhone 3 Development: Exploring the iPhone SDK
Book information
Description
Are you a programmer looking for a new challenge? Does the thought of building your very own iPhone app make your heart race and your pulse quicken? If so, Beginning iPhone 3 Development: Exploring the iPhone SDK is just the book for you. Updated and revised for iPhone SDK 3, many of the discussions in the original book have been clarified to make some of the more complex topics easier to understand. In addition, all of the projects have been rebuilt from scratch using the SDK 3 templates. For the latest version of this book for Swift, see Beginning iPhone Development with Swift, ISBN 978-1-4842-0410-8. For the latest version of this book for Objective-C, see Beginning iPhone Development: Exploring the iOS SDK, ISBN 978-1-4842-0200-5. Assuming only a minimal working knowledge of Objective-C, and written in a friendly, easy-to-follow style, this book offers a complete soup-to-nuts course in iPhone and iPod touch programming. The book starts with the basics, walking you through the process of downloading and installing Apple's free iPhone SDK, and then stepping you though the creation of your first simple iPhone application. From there, you'll learn to integrate all the interface elements iPhone users have come to know and love, such as buttons, switches, pickers, toolbars, and sliders. You'll master a variety of design patterns, from the simplest single view to complex hierarchical drill-downs. The confusing art of table building will be demystified, and you'll see how to save your data using the iPhone file system. You'll also learn how to save and retrieve your data using SQLite, iPhone's built-in database management system. In addition, you'll also learn about Core Data, an important persistence mechanism that has just been added with SDK 3. And there's much more! You'll learn to draw using Quartz 2D and OpenGL ES, add multitouch gestural support (pinches and swipes) to your applications, and work with the camera, photo library, accelerometer, and built-in GPS. You'll discover the fine points of application preferences and learn how to localize your apps for multiple languages. You can discover more about this book, download source code, and find support forums at the book's companion site, at www.iphonedevbook.com. The iPhone 3 update to the best-selling and most recommended book for iPhone developers Packed full of tricks, techniques, and enthusiasm for the new SDK from a developer perspective The most complete, useful, and up-to-date guide to all things having to do with Apple's iPhone SDK Prelims Contents at a Glance Contents Welcome to the Jungle What This Book Is What You Need Before You Can Begin What You Need to Know Before You Begin What’s Different About Coding for iPhone? Only One Running Application Only One Window Limited Access Limited Response Time Limited Screen Size Limited System Resources No Garbage Collection Some New Stuff A Different Approach What’s in This Book Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 What’s New in This Update? Are You Ready? Appeasing the Tiki Gods Setting Up Your Project in Xcode The Xcode Project Window Introducing Interface Builder What’s in the Nib File? Adding a Label to the View Some iPhone Polish— Finishing Touches Ready to Compile and Run Bring It on Home Handling Basic Interaction The Model-ViewController Paradigm Creating Our Project Creating the View Controller Outlets Actions Adding Actions and Outlets to the View Controller Adding Actions and Outlets to the Implementation File Using the Application Delegate Editing MainWindow.xib Editing Button_FunViewController.xib Creating the View in Interface Builder Connecting Everything Trying It Out Bring It on Home More User Interface Fun A Screen Full of Controls Active, Static, and Passive Controls Creating the Application Importing the Image Implementing the Image View and Text Fields Adding the Image View Adding the Text Fields Set the Attributes for the Second Text Field Connecting Outlets Build and Run Making the Keyboard Go Away When Done Is Tapped Touching the Background to Close the Keyboard Implementing the Slider and Label Determining Outlets Determining Actions Adding Outlets and Actions Adding the Slider and Label Connecting the Actions and Outlets Implementing the Switches, Button, and S egmented Control Determining Outlets Determining Actions Adding the Switches, Button, and Segmented Control Connecting the Switch Outlets and Actions Adding the Button Implementing the Action Sheet and Alert Conforming to the Action Sheet Delegate Method Showing the Action Sheet The Action Sheet Delegate and Creating an Alert Spiffing Up the Button The viewDidLoad Method Control States Stretchable Images Being a Good Memory Citizen Crossing the Finish Line Autorotation and Autosizing Handling Rotation Using Autosize Attributes Specifying Rotation Support Designing an Interface with Autosize Attributes Autosize Attributes Setting the Buttons’ Autosize Attributes Restructuring a View When Rotated Declaring and Connecting Outlets Moving the Buttons on Rotation Swapping Views Determining Outlets Determining Actions Declaring Actions and Outlets Designing the Two Views Implementing the Swap and the Action Rotating Out of Here Multiview Applications The View Switcher Application The Architecture of a Multiview Application Anatomy of a Content View Building View Switcher Creating Our View Controller and Nib Files Modifying the App Delegate SwitchViewController.h Modifying MainWindow.xib Writing SwitchViewController.m Implementing the Content Views Animating the Transition Switching Off Tab Bars and Pickers The Pickers Application Delegates and Datasources Setting Up the Tab Bar Framework Creating the Files Adding the Root View Controller Implementing the Date Picker Implementing the Single Component Picker Declaring Outlets and Actions Building the View Implementing the Controller as Datasource and Delegate Implementing a Multicomponent Picker Declaring Outlets and Actions Building the View Implementing the Controller Implementing Dependent Components Creating a Simple Game with a Custom Picker Writing the Controller Header File Building the View Adding Image Resources Implementing the Controller The spin Method The viewDidLoad Method Final Details Linking in the Audio Toolbox Framework Final Spin Introduction to Table Views Table View Basics Grouped and Plain Tables Implementing a Simple Table Designing the View Writing the Controller Adding an Image Table View Cell Styles Additional Configurations Setting the Indent Level Handling Row Selection Changing Font Size and Row Height What Else Can the Delegate Do? Customizing Table View Cells The Cells Application Adding Subviews to the Table View Cell Using a Custom Subclass of UITableViewCell Grouped and Indexed Sections Building the View Importing the Data Implementing the Controller Adding an Index Implementing a Search Bar Rethinking the Design A Deep Mutable Copy Updating the Controller Header File Modifying the View Modifying the Controller Implementation Putting It All on the Table Navigation Controllers and Table Views Navigation Controllers Stacky Goodness A Stack of Controllers Nav, a Hierarchical Application in Six Parts Constructing the Nav Application’s Skeleton Creating the First Level View Controller Setting Up the Navigation Controller Our First Subcontroller: The Disclosure Button View Our Second Subcontroller: The Checklist Our Third Subcontroller: Controls on Table Rows Our Fourth Subcontroller: Moveable Rows Editing Mode Creating a New Second-Level Controller Our Fifth Subcontroller: Deletable Rows Our Sixth Subcontroller: An Editable Detail Pane Creating the Data Model Object Creating the Controllers Creating the Detail View Controller But There’s One More Thing. . . Breaking the Tape Application Settings and User Defaults Getting to Know Your Settings Bundle The AppSettings Application Creating the Project Working with the Settings Bundle Adding a Settings Bundle to Our Project Setting Up the Property List Adding a Text Field Setting Adding a Secure Text Field Setting Adding a Multivalue Field Adding a Toggle Switch Setting Adding the Slider Setting Adding a Child Settings View Reading Settings in Our Application Changing Defaults from Our Application Beam Me Up, Scotty Basic Data Persistence Your Application’s Sandbox Getting the Documents Directory Getting the tmp Directory File Saving Strategies Single-File Persistence Multiple-File Persistence Persisting Application Data Property List Serialization The Persistence Application Creating the Persistence Project Designing the Persistence Application View Editing the Persistence Classes Archiving Model Objects Implementing NSCopying The Archiving Application Implementing the FourLines Class Implementing the PersistenceViewController Class Using iPhone’s Embedded SQLite3 Setting Up a Project to Use SQLite3 Using Core Data Entities and Managed Objects Key-Value Coding Putting It All in Context Creating New Managed Objects Retrieving Managed Objects Designing the Data Model Creating the Persistence View and Controller Making Persistence View Controller our Application’s Root Controller Persistence Rewarded Drawing with Quartz and OpenGL Two Views of a Graphical World This Chapter’s Drawing A pplication The Quartz Approach to Drawing Quartz 2D’s Graphics Contexts The Coordinates System Specifying Colors Drawing Images in Context Drawing Shapes: Polygons, Lines, and Curves Quartz 2D Tool Sampler: Patterns, Gradients, and Dash Patterns Building the QuartzFun Application Creating a Random Color Defining Application Constants Implementing the QuartzFunView Skeleton Adding Outlets and Actions to the View Controller Updating QuartzFunViewController.xib Drawing the Line Drawing the Rectangle and Ellipse Drawing the Image Optimizing the QuartzFun Application Some OpenGL ES Basics Building the GLFun Application Design the Nib, Add the Frameworks, Run the App Drawing a Blank Taps, Touches, and Gestures Multitouch Terminology The Responder Chain Forwarding an Event: Keeping the Responder Chain Alive The Multitouch Architecture The Four Gesture Notification Methods The Touch Explorer Application The Swipes Application Implementing Multiple Swipes Detecting Multiple Taps Detecting Pinches Defining Custom Gestures The CheckPlease Touch Methods Garçon? Check, Please! Where Am I? Finding Your Way with Core Location The Location Manager Setting the Desired Accuracy Setting the Distance Filter Starting the Location Manager Using the Location Manager Wisely The Location Manager Delegate Getting Location Updates Getting Latitude and Longitude Using CLLocation Error Notifications Trying Out Core Location Updating Location Manager Determining Distance Traveled Wherever You Go, There You Are Whee! Accelerometer! Accelerometer Physics Accessing the Accelerometer UIAcceleration Implementing the accelerometer:didAccelerate: Method Shake and Break The Code That Breaks Load the Simulation Files All Better—The Healing Touch The Rolling Marble Program Implementing the Ball View Controller Writing the Ball View Calculating Ball Movement Rolling On iPhone Camera and Photo Library Using the Image Picker and UII magePickerController Implementing the Image Picker Controller Delegate Road Testing the Camera and Library Designing the Interface Implementing the Camera View Controller It’s a Snap! Application Localization Localization Architecture Using String Files Creating the Strings File Real-World iPhone: Localizing Your A pplication Looking at the Current Locale Trying Out LocalizeMe Localizing the Nib Looking at the Localized Project Structure Localizing an Image Localizing the Application Icon Generating and Localizing a Strings File Where to Next? Getting Unstuck Apple’s Documentation Mailing Lists Discussion Forums Web Sites Blogs Dave and Jeff Blogs and Twitter More iPhone 3 Development And If All Else Fails. . . Farewell index
Similar books
Beginning iOS6 Development: Exploring the iOS SDK
2013 · PDF
Beginning iPhone development with Swift : exploring the iOS SDK
2014 · EPUB
More iPhone Development with Swift
2015 · PDF
Learn Cocoa on the Mac
2009 · PDF
More iPhone Development with Objective-C, 3rd Edition
2015 · PDF
More iPhone Development with Swift: Exploring the iOS SDK
2015 · PDF
Beginning iOS 5 Development: Exploring the iOS SDK
2 · PDF
Beginning iOS 6 Development: Exploring the iOS SDK
2013 · PDF