Home Page Icon
Home Page
Table of Contents for
About the Authors
Close
About the Authors
by Jeff LaMarche, Dave Mark
Beginning iPhone 3 Development: Exploring the iPhone SDK
Copyright
About the Authors
About the Technical Reviewer
Acknowledgments
Preface to Beginning iPhone 3 Development
Preface to Beginning iPhone 2 Development
1. Welcome to the Jungle
1.1. What This Book Is
1.2. What You Need Before You Can Begin
1.3. What You Need to Know Before You Begin
1.4. What's Different About Coding for iPhone?
1.4.1. Only One Running Application
1.4.2. Only One Window
1.4.3. Limited Access
1.4.4. Limited Response Time
1.4.5. Limited Screen Size
1.4.6. Limited System Resources
1.4.7. No Garbage Collection
1.4.8. Some New Stuff
1.4.9. A Different Approach
1.5. What's in This Book
1.5.1. Chapter 2
1.5.2. Chapter 3
1.5.3. Chapter 4
1.5.4. Chapter 5
1.5.5. Chapter 6
1.5.6. Chapter 7
1.5.7. Chapter 8
1.5.8. Chapter 9
1.5.9. Chapter 10
1.5.10. Chapter 11
1.5.11. Chapter 12
1.5.12. Chapter 13
1.5.13. Chapter 14
1.5.14. Chapter 15
1.5.15. Chapter 16
1.5.16. Chapter 17
1.5.17. Chapter 18
1.6. What's New in This Update?
1.7. Are You Ready?
2. Appeasing the Tiki Gods
2.1. Setting Up Your Project in Xcode
2.1.1. The Xcode Project Window
2.2. Introducing Interface Builder
2.2.1. What's in the Nib File?
2.2.2. Adding a Label to the View
2.3. Some iPhone Polish—Finishing Touches
2.3.1. Ready to Compile and Run
2.4. Bring It on Home
3. Handling Basic Interaction
3.1. The Model-View-Controller Paradigm
3.2. Creating Our Project
3.3. Creating the View Controller
3.3.1. Outlets
3.3.2. Actions
3.3.3. Adding Actions and Outlets to the View Controller
3.3.3.1. Objective-C Properties
3.3.3.2. Declaring the Action Method
3.3.4. Adding Actions and Outlets to the Implementation File
3.4. Using the Application Delegate
3.5. Editing MainWindow.xib
3.6. Editing Button_FunViewController.xib
3.6.1. Creating the View in Interface Builder
3.6.2. Connecting Everything
3.6.2.1. Connecting Outlets
3.6.2.2. Specifying Actions
3.6.3. Trying It Out
3.7. Bring It on Home
4. More User Interface Fun
4.1. A Screen Full of Controls
4.2. Active, Static, and Passive Controls
4.3. Creating the Application
4.3.1. Importing the Image
4.3.2. Implementing the Image View and Text Fields
4.3.2.1. Determining Outlets
4.3.2.2. Determining Actions
4.3.2.3. Building the Interface
4.3.3. Adding the Image View
4.3.3.1. Resize the Image View
4.3.3.2. The Mode Attribute
4.3.3.3. The Alpha Slider
4.3.3.4. Ignore the Background
4.3.3.5. The Tag Attribute
4.3.3.6. The Drawing Checkboxes
4.3.3.7. The Interaction Checkboxes
4.3.4. Adding the Text Fields
4.3.4.1. The Text Field Inspector Settings
4.3.4.2. Text Input Traits
4.3.4.3. And the Rest ...
4.3.5. Set the Attributes for the Second Text Field
4.3.6. Connecting Outlets
4.4. Build and Run
4.4.1. Making the Keyboard Go Away When Done Is Tapped
4.4.2. Touching the Background to Close the Keyboard
4.5. Implementing the Slider and Label
4.5.1. Determining Outlets
4.5.2. Determining Actions
4.5.3. Adding Outlets and Actions
4.5.4. Adding the Slider and Label
4.5.5. Connecting the Actions and Outlets
4.6. Implementing the Switches, Button, and Segmented Control
4.6.1. Determining Outlets
4.6.2. Determining Actions
4.6.2.1. Releasing the Outlets
4.6.3. Adding the Switches, Button, and Segmented Control
4.6.3.1. Adding Two Labeled Switches
4.6.4. Connecting the Switch Outlets and Actions
4.6.5. Adding the Button
4.6.5.1. Connecting the Buttons Outlets and Actions
4.7. Implementing the Action Sheet and Alert
4.7.1. Conforming to the Action Sheet Delegate Method
4.7.2. Showing the Action Sheet
4.7.3. The Action Sheet Delegate and Creating an Alert
4.8. Spiffing Up the Button
4.8.1. The viewDidLoad Method
4.8.2. Control States
4.8.3. Stretchable Images
4.9. Being a Good Memory Citizen
4.10. Crossing the Finish Line
5. Autorotation and Autosizing
5.1. Handling Rotation Using Autosize Attributes
5.1.1. Specifying Rotation Support
5.1.2. Designing an Interface with Autosize Attributes
5.1.3. Autosize Attributes
5.1.4. Setting the Buttons' Autosize Attributes
5.2. Restructuring a View When Rotated
5.2.1. Declaring and Connecting Outlets
5.2.2. Moving the Buttons on Rotation
5.3. Swapping Views
5.3.1. Determining Outlets
5.3.2. Determining Actions
5.3.3. Declaring Actions and Outlets
5.3.4. Designing the Two Views
5.3.5. Implementing the Swap and the Action
5.4. Rotating Out of Here
6. Multiview Applications
6.1. The View Switcher Application
6.2. The Architecture of a Multiview Application
6.2.1. Anatomy of a Content View
6.3. Building View Switcher
6.3.1. Creating Our View Controller and Nib Files
6.3.2. Modifying the App Delegate
6.3.3. SwitchViewController.h
6.3.4. Modifying MainWindow.xib
6.3.5. Writing SwitchViewController.m
6.3.6. Implementing the Content Views
6.4. Animating the Transition
6.5. Switching Off
7. Tab Bars and Pickers
7.1. The Pickers Application
7.2. Delegates and Datasources
7.3. Setting Up the Tab Bar Framework
7.3.1. Creating the Files
7.3.2. Adding the Root View Controller
7.4. Implementing the Date Picker
7.5. Implementing the Single Component Picker
7.5.1. Declaring Outlets and Actions
7.5.2. Building the View
7.5.3. Implementing the Controller as Datasource and Delegate
7.6. Implementing a Multicomponent Picker
7.6.1. Declaring Outlets and Actions
7.6.2. Building the View
7.6.3. Implementing the Controller
7.7. Implementing Dependent Components
7.8. Creating a Simple Game with a Custom Picker
7.8.1. Writing the Controller Header File
7.8.2. Building the View
7.8.3. Adding Image Resources
7.8.4. Implementing the Controller
7.8.5. The spin Method
7.8.6. The viewDidLoad Method
7.8.7. Final Details
7.8.8. Linking in the Audio Toolbox Framework
7.9. Final Spin
8. Introduction to Table Views
8.1. Table View Basics
8.1.1. Grouped and Plain Tables
8.2. Implementing a Simple Table
8.2.1. Designing the View
8.2.2. Writing the Controller
8.3. Adding an Image
8.3.1. Table View Cell Styles
8.4. Additional Configurations
8.4.1. Setting the Indent Level
8.4.2. Handling Row Selection
8.4.3. Changing Font Size and Row Height
8.4.4. What Else Can the Delegate Do?
8.5. Customizing Table View Cells
8.5.1. The Cells Application
8.5.2. Adding Subviews to the Table View Cell
8.5.2.1. Modifying the Controller Header File
8.5.2.2. Implementing the Controller's Code
8.5.3. Using a Custom Subclass of UITableViewCell
8.5.3.1. Creating the UITableViewCell Subclass
8.5.3.2. Designing the Table View Cell in Interface Builder
8.5.3.3. Using the New Table View Cell
8.6. Grouped and Indexed Sections
8.6.1. Building the View
8.6.2. Importing the Data
8.6.3. Implementing the Controller
8.6.4. Adding an Index
8.7. Implementing a Search Bar
8.7.1. Rethinking the Design
8.7.2. A Deep Mutable Copy
8.7.3. Updating the Controller Header File
8.7.4. Modifying the View
8.7.5. Modifying the Controller Implementation
8.7.5.1. Copying Data from allNames
8.7.5.2. Implementing the Search
8.7.5.3. Changes to viewDidLoad
8.7.5.4. Changes to Datasource Methods
8.7.5.5. Adding a Table View Delegate Method
8.7.5.6. Adding Search Bar Delegate Methods
8.7.5.7. Adding a Magnifying Glass to the Index
8.7.5.7.1. ADDING THE SPECIAL VALUE TO THE KEYS ARRAY
8.7.5.7.2. SUPPRESSING THE SECTION HEADER
8.7.5.7.3. TELLING THE TABLE VIEW WHAT TO DO
8.8. Putting It All on the Table
9. Navigation Controllers and Table Views
9.1. Navigation Controllers
9.1.1. Stacky Goodness
9.1.2. A Stack of Controllers
9.2. Nav, a Hierarchical Application in Six Parts
9.3. Constructing the Nav Application's Skeleton
9.3.1. Creating the First Level View Controller
9.3.2. Setting Up the Navigation Controller
9.4. Our First Subcontroller: The Disclosure Button View
9.5. Our Second Subcontroller: The Checklist
9.6. Our Third Subcontroller: Controls on Table Rows
9.7. Our Fourth Subcontroller: Moveable Rows
9.7.1. Editing Mode
9.7.2. Creating a New Second-Level Controller
9.8. Our Fifth Subcontroller: Deletable Rows
9.9. Our Sixth Subcontroller: An Editable Detail Pane
9.9.1. Creating the Data Model Object
9.9.2. Creating the Controllers
9.9.3. Creating the Detail View Controller
9.10. But There's One More Thing...
9.11. Breaking the Tape
10. Application Settings and User Defaults
10.1. Getting to Know Your Settings Bundle
10.2. The AppSettings Application
10.3. Creating the Project
10.4. Working with the Settings Bundle
10.4.1. Adding a Settings Bundle to Our Project
10.4.2. Setting Up the Property List
10.4.3. Adding a Text Field Setting
10.4.4. Adding a Secure Text Field Setting
10.4.5. Adding a Multivalue Field
10.4.6. Adding a Toggle Switch Setting
10.4.7. Adding the Slider Setting
10.4.8. Adding a Child Settings View
10.5. Reading Settings in Our Application
10.6. Changing Defaults from Our Application
10.7. Beam Me Up, Scotty
11. Basic Data Persistence
11.1. Your Application's Sandbox
11.1.1. Getting the Documents Directory
11.1.2. Getting the tmp Directory
11.2. File Saving Strategies
11.2.1. Single-File Persistence
11.2.2. Multiple-File Persistence
11.3. Persisting Application Data
11.3.1. Property List Serialization
11.4. The Persistence Application
11.4.1. Creating the Persistence Project
11.4.2. Designing the Persistence Application View
11.4.3. Editing the Persistence Classes
11.4.4. Archiving Model Objects
11.4.4.1. Conforming to NSCoding
11.4.5. Implementing NSCopying
11.4.5.1. Archiving a Data Object
11.4.5.2. Unarchiving a Data Object
11.5. The Archiving Application
11.5.1. Implementing the FourLines Class
11.5.2. Implementing the PersistenceViewController Class
11.6. Using iPhone's Embedded SQLite3
11.6.1.
11.6.1.1. Creating or Opening the Database
11.6.1.2. Bind Variables
11.6.2. Setting Up a Project to Use SQLite3
11.7. Using Core Data
11.7.1. Entities and Managed Objects
11.7.2. Key-Value Coding
11.7.3. Putting It All in Context
11.7.4. Creating New Managed Objects
11.7.5. Retrieving Managed Objects
11.7.6. Designing the Data Model
11.7.7. Creating the Persistence View and Controller
11.7.8. Making Persistence View Controller our Application's Root Controller
11.8. Persistence Rewarded
12. Drawing with Quartz and OpenGL
12.1. Two Views of a Graphical World
12.2. This Chapter's Drawing Application
12.3. The Quartz Approach to Drawing
12.3.1. Quartz 2D's Graphics Contexts
12.3.2. The Coordinates System
12.3.3. Specifying Colors
12.3.3.1. A Bit of Color Theory for Your iPhone's Display
12.3.3.2. More Than Color Meets the Eye
12.3.4. Drawing Images in Context
12.3.5. Drawing Shapes: Polygons, Lines, and Curves
12.3.6. Quartz 2D Tool Sampler: Patterns, Gradients, and Dash Patterns
12.4. Building the QuartzFun Application
12.4.1. Creating a Random Color
12.4.2. Defining Application Constants
12.4.3. Implementing the QuartzFunView Skeleton
12.4.4. Adding Outlets and Actions to the View Controller
12.4.5. Updating QuartzFunViewController.xib
12.4.6. Drawing the Line
12.4.7. Drawing the Rectangle and Ellipse
12.4.8. Drawing the Image
12.4.9. Optimizing the QuartzFun Application
12.5. Some OpenGL ES Basics
12.5.1. Building the GLFun Application
12.5.2. Design the Nib, Add the Frameworks, Run the App
12.6. Drawing a Blank
13. Taps, Touches, and Gestures
13.1. Multitouch Terminology
13.2. The Responder Chain
13.2.1. Forwarding an Event: Keeping the Responder Chain Alive
13.3. The Multitouch Architecture
13.3.1. The Four Gesture Notification Methods
13.4. The Touch Explorer Application
13.5. The Swipes Application
13.6. Implementing Multiple Swipes
13.7. Detecting Multiple Taps
13.8. Detecting Pinches
13.9. Defining Custom Gestures
13.9.1. The CheckPlease Touch Methods
13.10. Garçon? Check, Please!
14. Where Am I? Finding Your Way with Core Location
14.1. The Location Manager
14.1.1. Setting the Desired Accuracy
14.1.2. Setting the Distance Filter
14.1.3. Starting the Location Manager
14.1.4. Using the Location Manager Wisely
14.2. The Location Manager Delegate
14.2.1. Getting Location Updates
14.2.2. Getting Latitude and Longitude Using CLLocation
14.2.3. Error Notifications
14.3. Trying Out Core Location
14.3.1. Updating Location Manager
14.3.2. Determining Distance Traveled
14.4. Wherever You Go, There You Are
15. Whee! Accelerometer!
15.1. Accelerometer Physics
15.2. Accessing the Accelerometer
15.2.1. UIAcceleration
15.2.2. Implementing the accelerometer:didAccelerate: Method
15.2.2.1. Detecting Shakes
15.2.2.2. Accelerometer as Directional Controller
15.3. Shake and Break
15.3.1. The Code That Breaks
15.3.2. Load the Simulation Files
15.3.3. All Better—The Healing Touch
15.4. The Rolling Marble Program
15.4.1. Implementing the Ball View Controller
15.4.2. Writing the Ball View
15.4.3. Calculating Ball Movement
15.5. Rolling On
16. iPhone Camera and Photo Library
16.1. Using the Image Picker and UIImagePickerController
16.2. Implementing the Image Picker Controller Delegate
16.3. Road Testing the Camera and Library
16.3.1. Designing the Interface
16.3.2. Implementing the Camera View Controller
16.4. It's a Snap!
17. Application Localization
17.1. Localization Architecture
17.2. Using String Files
17.2.1. Creating the Strings File
17.3. Real-World iPhone: Localizing Your Application
17.3.1. Looking at the Current Locale
17.3.2. Trying Out LocalizeMe
17.3.3. Localizing the Nib
17.3.4. Looking at the Localized Project Structure
17.3.5. Localizing an Image
17.3.6. Localizing the Application Icon
17.3.7. Generating and Localizing a Strings File
17.4. Auf Wiedersehen
18. Where to Next?
18.1. Getting Unstuck
18.1.1. Apple's Documentation
18.1.2. Mailing Lists
18.1.3. Discussion Forums
18.1.4. Web Sites
18.1.5. Blogs
18.1.6. Dave and Jeff Blogs and Twitter
18.1.7. More iPhone 3 Development
18.1.8. And If All Else Fails...
18.2. Farewell
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Copyright
Next
Next Chapter
About the Technical Reviewer
About the Authors
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset