Let's say you have a killer app idea for iPhone and iPad. Where do you begin? Head First iPhone and iPad Development will help you get your first application up and running in no time. You'll not only learn how to design for Apple's devices, you'll also master the iPhone SDK tools -- including Interface Builder, Xcode, and Objective-C programming principles -- to make your app stand out.
Whether you're a seasoned Mac developer who wants to jump into the App store, or someone with strong object-oriented programming skills but no Mac experience, this book is a complete learning experience for creating eye-catching, top-selling iPhone and iPad applications.
- Install the iPhone OS SDK and get started using Interface Builder and XCode
- Put Objective-C core concepts to work, including message passing, protocols, properties, and memory management
- Take advantage of iPhone OS patterns such as datasources and delegates
- Preview your applications in the Simulator
- Build more complicated interactions that utilize multiple views, data entry/editing, and rotation
- Work with the iPhone's camera, GPS, and accelerometer
- Optimize, test, and distribute your application
We think your time is too valuable to waste struggling with new concepts. Using the latest research in cognitive science and learning theory to craft a multi-sensory learning experience, Head First iPhone and iPad Development has a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep.
Table of contents
- Head First iPhone and iPad Development
- A Note Regarding Supplemental Files
- Advance Praise for Head First iPhone and iPad Development
- Praise for other Head First books
- Authors of Head First iPhone and iPad Development
How to use this Book: Intro
- Who is this book for?
- Who should probably back away from this book?
- Metacognition: thinking about thinking
- Here’s what YOU can do to bend your brain into submission
- Read me
- The technical review team
- Safari® Books Online
1. Getting Started: Going Mobile with iOS
- So, you want to build an iOS app...
- ...‘cause everyone wants one!
- Apps live in an iTunes universe
- Time to make a decision
- It all starts with the iOS SDK
- Take a look around
- Xcode includes app templates to help you get started
- Xcode is a full-featured IDE
- Xcode is the hub of your iOS project
- Build your interface within Xcode
- Add the button to your view
- The iOS simulator lets you test your app on your Mac
- iDecide’s logic
- Changing the button text
- You’re using the Model View Controller pattern
- iDecide is actually a little simpler
- What happened?
- Use the GUI editor to connect UI controls to code
- A component can trigger certain events
- Connect your events to methods
- You’ve built your first iPhone app!
- Your iOS Toolbox
2. iOS App Patterns: Hello, Renee!
- First, we need to figure out what Mike (really) wants
- App design rules—the iOS HIG
- HIG guidelines for pickers and buttons
- Create a new View-based project for InstaEmail
- The life of a root view
- We need data
- Use pickers when you want controlled input
- Pickers get their data from a datasource...
- That pattern is back
- First, declare that the controller conforms to both protocols
- The datasource protocol has two required methods
- Connect the datasource just like actions and outlets
- There’s just one method for the delegate protocol
- Actions, outlets, and events
- Connect the event to the action
- Add the IBOutlet and property to your view controller
- Next, synthesize the property...
- Connect the picker to our outlet
- Use your picker reference to pull the selected values
- Your iOS Toolbox
3. Objective-C for iOS: Email needs variety
- Renee is catching on....
- Make room for custom input
- Header files describe the interface to your class
- Auto-generated accessors also handle memory management
- To keep your memory straight, you need to remember just two things
- But when Mike’s finished typing...
- Customize your UITextField
- Components that use the keyboard ask it to appear...
- Ask the UITextField to give up focus
- Messages in Objective-C use named arguments
- Use message passing to tell our View Controller when the Done button is pressed
- Where’s the custom note?
- Your Objective-C Toolbox
4. Multiple Views: A table with a view
- So, how do these views fit together?
- The navigation template pulls multiple views together
- The table view is built in
- A table is a collection of cells
- Just a few more drinks...
- Plists are an easy way to save and load data
- Arrays (and more) have built-in support for plists
- Use a detail view to drill down into data
- A closer look at the detail view
- Use the Navigation Controller to switch between views
- Navigation Controllers maintain a stack of View Controllers
- Dictionaries store information as key-value pairs
- Debugging—the dark side of iOS development
- First stop on your debugging adventure: the console
- Interact with your application while it’s running
- Xcode supports you after your app breaks, too
- The Xcode debugger shows you the state of your application
- Your iOS Toolbox
5. Plists and Modal Views: Refining your app
- It all started with Sam...
- Use the debugger to investigate the crash
- Update your code to handle a plist of dictionaries
- The Detail View needs data
- The other keys are key
- We have a usability problem
- Use a disclosure button to show that there are more details available
- Sales were going strong
- Use Navigation Controller buttons to add drinks
- The button should create a new view
- We need a view...but not necessarily a new view
- The View Controller defines the behavior for the view
- A nib file contains the UI components and connections...
- You can subclass and extend view controllers like any other class
- Modal views focus the user on the task at hand...
- Any view can present a modal view
- Our modal view doesn’t have a navigation bar
- Create the Save and Cancel buttons
- Write the Save and Cancel actions
- Your iOS Toolbox
6. Saving, Editing, and Sorting Data: Everyone’s an editor...
- Sam is ready to add a Red-Headed School Girl...
- ...but the keyboard is in the way
- Wrap your content in a scroll view
- The scroll view is the same size as the screen
- The keyboard changes the visible area
- iOS notifies you about the keyboard
- Register with the default notification center for events
- Keyboard events tell you the keyboard state and size
- The table view doesn’t know its data has changed
- The array is out of order, too
- Table views have built-in support for editing and deleting
- Your iOS Development Toolbox
- 7. Migrating to iPad: We need more room
8. Tab Bars and Core Data: Enterprise apps
- HF bounty hunting
- A new iPhone control
- Choose a template to start iBountyHunter
- There’s a different structure for universal apps
- Drawing how iBountyHunter iPhone works...
- ...and how it fits with the universal app
- Build the fugitive list view
- Next up: the Captured view
- A view’s contents are actually subviews
- After a quick meeting with Bob...
- Core Data lets you focus on your app
- Core Data needs to know what to load
- Core Data describes entities with a Managed Object Model
- Build your Fugitive entity
- Use an NSFetchRequest to describe your search
- Bob’s database is a resource
- Back to the Core Data stack
- The template sets things up for a SQLite DB
- iOS Apps are read-only
- The iPhone’s application structure defines where you can read and write
- Copy the database to the Documents directory
- Your Core Data Toolbox
9. Migrating and Optimizing with Core Data: Things are changing
- Bob needs documentation
- Everything stems from our object model
- The data hasn’t been updated
- Data migration is a common problem
- Migrate the old data into the new model
- Xcode makes it easy to version your data model
- Core Data can “lightly” migrate data
- Here’s what you’ve done so far...
- Bob has some design input
- Your app has a lifecycle all its own...
- Multitasking rules of engagement
- A quick demo with Bob
- Use predicates for filtering data
- We need to set a predicate on our NSFetchRequest
- Core Data controller classes provide efficient results handling
- Time for some high-efficiency streamlining
- Create the new FetchedResultsController getter method
- We need to refresh the data
- Your Data Toolbox
10. Camera, Map Kit, and Core Location: Proof in the real world
- For Bob, payment requires proof
- The way to the camera...
- There’s a method for checking
- Prompt the user with action sheets
- Bob needs the where, in addition to the when
- Core Location can find you in a few ways
- Add a new framework
- Just latitude and longitude won’t work for Bob
- Map Kit comes with iOS
- A little custom setup for the map
- Annotations require a little more work finesse
- Fully implement the annotation protocol
- Your Location Toolbox
11. iPad UI: Natural interfaces
- Bob needs that iPad app, too...
- iOS HIG user experience guidelines
- Iterate your interface, too
- BountyHunterHD is based on a Split View Controller
- Unifying the custom stuff
- It seems we have a problem...
- UIWebview has lots of options
- HTML, CSS, and Objective-C
- Using UIWebView
- Your NUI Toolbox
A. Leftovers: The top 4 things (we didn’t cover)
- #1. Internationalization and Localization
- Localizing string resources
- #2. View animations
- #3. Accelerometer
- Understanding device acceleration
- #4. A word or two about gaming...
- Quartz and OpenGL
- B. Preparing an App for Distribution: Get ready for the App Store
- About the Authors
- Title: Head First iPhone and iPad Development, 2nd Edition
- Release date: June 2011
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449387822
You might also like
Learning React, 2nd Edition
If you want to learn how to build efficient React applications, this is your book. Ideal …
Designing Data-Intensive Applications
Data is at the center of many challenges in system design today. Difficult issues need to …
Introducing Python, 2nd Edition
Easy to understand and fun to read, this updated edition of Introducing Python is ideal for …
Head First Python, 2nd Edition
Want to learn the Python language without slogging your way through how-to manuals? With Head First …