
Head First iPhone Development
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
More details
Other editions
Additional editions
Content
- Intro
- Advance Praise for Head First iPhone Development
- Copyright
- Dedication
- The Authors
- Table of Contents
- 1. getting started: Going mobile
- 2. iPhone app patterns: Hello @twitter!
- 3. objective-c for the iPhone: Twitter needs variety
- 4. multiple views: A table with a view
- 5. plists and modal views: Refining your app
- 6. saving, editing, and sorting data: Everyone's an editor...
- 7. tab bars and core data: Enterprise apps
- 8. migrating and optimizing with core data: Things are changing
- 9. camera, map kit, and core location: Proof in the real world
- appendix i, leftovers: The top 6 things (we didn't cover)
- appendix ii, preparing your app for distribution: Get ready for the App Store
- how to use this book: Intro
- Who is this book for?
- Who should probably back away from this book?
- We know what you're thinking.
- And we know what your brain is thinking.
- Metacognition: thinking about thinking
- Here's what WE did:
- Here's what YOU can do to bend your brain into submission
- Read me
- System requirements
- The technical review team
- Acknowledgments
- Safari® Books Online
- 1. getting started: Going mobile
- There's a lot of buzz and a lot of money tied up inthe App Store...
- Mobile applications aren't just ported desktop apps
- iPhone apps are not small desktop apps
- Anatomy of an iPhone app
- First we have one or more views...
- ...then the code that makes the views work...
- ...and any other resources, all packaged intoyour application.
- Mike can't make a decision
- Make a good first impression
- It all starts with the iPhone SDK
- Xcode includes app templates to help you get started
- Xcode is the hub of your iPhone project...
- Build your interface using... Interface Builder
- Add the button to your view
- The iPhone Simulator lets you test your app on your Mac
- What happened?
- Unless the UI components are hooked up to the code, nothing is going to happen.
- Use Interface Builder to connect UI controls to code
- Interface Builder lists which events a component can trigger
- Elements dispatch events when things happen to them
- Connect your events to methods
- iPhonecross
- iPhonecross Solution
- Your iPhone Toolbox
- 2. iPhone app patterns: Hello @twitter!
- First we need to figure out what Mike (really) wants
- App design rules-the iPhone HIG
- Application types
- HIG guidelines for pickers and buttons
- Create a new View-based project for InstaTwit
- Start with the view layout
- The life of a root view
- First, get the data from Mike
- Use pickers when you want controlled input
- When in doubt, check out Apple's API documentation
- Fill the picker rows with Mike's data
- Pickers get their data from a datasource...
- ...and tell their delegates when something happens.
- There's a pattern for that
- Controls have their own specific datasources and delegates
- Protocols tell you what methods (messages) you need to implement
- First, declare that the controller conforms to both protocols
- Next, add Mike's activities and feelings to the implementation file
- The datasource protocol has two required methods
- Connect the datasource just like actions and outlets
- There's just one method for the delegate protocol
- The button needs to be connected to an event
- Without an action, your button won't work!
- Add the IBOutlet and property to our view controller
- Connect the picker to our outlet
- Use our picker reference to pull the selected values
- iPhonecross
- iPhonecross Solution
- Your iPhone Toolbox
- 3. objective-c for the iPhone: Twitter 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
- Objective-C can automatically release references, too.
- To keep your memory straight, you need to remember just two things
- But when Mike's finished typing...
- Customize your UITextField
- Next change the label on the return key
- Components that use the keyboard ask it to appear...
- ...by passing messages to other objects
- Ask the textField to give up focus
- Messages in Objective-C use named arguments
- Use message passing to tell our viewcontroller when the Done button is pressed
- Something's still not right
- Build the tweet with strings
- Objective-Ccross
- Your Objective-C Toolbox
- Objective-Ccross Solution
- 4. multiple views: A table with a view
- So, how do these views fit together?
- The navigation template pulls multiple views together
- The navigation template starts with a table view
- A table is a collection of cells
- Each drink gets its own cell... sorta
- Just a few more drinks
- Plists are an easy way to save and load data
- Built-in types can save and load from plists automatically
- 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 views
- We'll use the tap notification in the table view delegate
- Instantiate a view controller like any other class
- Dictionaries store informationas key-value pairs
- Debugging-the dark side of iPhone development
- Warnings can help find problems without debugging
- First stop on your debugging adventure: the console
- Interact with your application while it's running
- And when it's about to stop running
- Xcode supports you after your app breaks, too
- The Xcode debugger shows you the state of your application
- What the heck is going on?
- MultipleViewscross
- Your iPhone Toolbox
- MultipleViewscross Solution
- 5. plists and modal views: Refining your app
- It all started with Sam...
- Use the debugger to investigate the crash
- We're trying to stuff a dictionary into a string
- Update your code to handle a plist of dictionaries
- The detail view needs data
- Each dictionary has all the information we need
- We have a usability problem
- Use a disclosure indicator if your cell leads to more information
- Sales were going strong...
- Use navigation controller buttons for editing
- 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...
- ...and information about the nib's File's Owner
- You can subclass and extend views like any other class
- Use Xcode to create a view controller without a nib
- Modal views focus the user on the task at hand...
- ...like adding or editing items
- Any view can present a modal view
- Our view doesn't have a navigation bar
- Create the save and cancel buttons
- Write the save and cancel actions
- iPhoneDevcross
- Your iPhone Toolbox
- iPhoneDevcross Solution
- 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
- We need to wrap our content in a scroll view
- The scroll view is the same size as the screen
- The keyboard changes the visible area
- iPhone notifies you about the keyboard
- Register with the default notification center for events
- Then unregister when you're done
- Keyboard events tell you the keyboard state and size
- The table view doesn't know its data has changed
- You need to ask the table view to reload its data
- The array is out of order, too
- We can sort our array using NSSortDescriptor
- Table views have built-in support for editing and deleting
- NavigationControllercross
- NavigationControllercross Solution
- Your iPhone Development Toolbox
- 7. tab bars and core data: Enterprise apps
- HF bounty hunting
- Choose a template to start iBountyHunter
- Drawing how iBountyHunter works...
- Build the fugitive list view
- Next up: the captured view
- After a quick meeting with Bob...
- Core Data lets you focus on your app
- But wait, there's more!
- Core Data needs to know what to load
- We need to define our types...
- Core Data describes entities with a Managed Object Model
- Build your Fugitive entity
- Whip up a Fugitive class without writing a line
- Our generated Fugitive class matches our Managed Object Model
- NSManagedObject handles storage and memory for generated properties
- NSManagedObject also implements the properties
- Use an NSFetchRequest to describe your search
- Ask the Managed Object Context to fetch data using your NSFetchRequest
- Add the database as a resource
- Back to the Core Data stack
- The template sets things up for a SQLite DB
- iPhone Apps are read-only
- The iPhone's application structure defines where you can read and write
- Use the Documents directory to store user data
- Copy the database to the correct place
- To be continued...
- CoreDatacross
- Your Core Data Toolbox
- CoreDatacross Solution
- 8. migrating and optimizing with core data: Things are changing
- Bob needs documentation
- Everything stems from our object model
- The data hasn't been updated
- Core Data caught a mismatch between our DB and our model
- Data migration is a common problem
- We need to migrate the old data into the new model
- Our two models need different versions
- Xcode makes it easy to version the data model
- Core Data can "lightly" migrate data
- Bob has some design input
- The Managed Object Context saves new or changed items
- A quick demo with Bob
- Use predicates for filtering data
- NSFetchRequest concepts are nearly identical to SQL
- We need to set a predicate on our NSFetchRequest
- Core Data controller classes provide efficient results handling
- Table views and NSFetchedResultsControllers are made for each other
- Time for some high-efficiency streamlining
- Next we need to change thesearch to use the controller...
- Refactor viewWillAppear to use the controller
- We need to refresh the data
- NSFetchedResultsController can check for changes
- DataMigrationcross
- DataMigrationcross Solution
- Your Data Toolbox
- 9: camera, map kit, and core location: Proof in the real world
- For Bob, payment requires proof!
- Flip over for the detail view!
- The way to the camera...
- The iPhone isn't the only device using apps
- There's a method for checking
- Prompt the user with action sheets
- We'll use action sheets to let the user pick the image source
- Bob needs the where, in addition to the when
- Core Location can find you in a few ways
- Core Location relies on the LocationManager
- Add a new framework
- Then update the header file
- Just latitude and longitude won't work for Bob
- Map Kit is new with iPhone 3.0
- A little custom setup for the map
- Annotations require a little more finesse
- AddingFunctionalitycross
- AddingFunctionalitycross Solution
- Your extras Toolbox
- It's been great having you here!
- i. leftovers: The top 6 things (we didn't cover)
- #1. Internationalization and Localization
- Localizing nibs
- Localizing string resources
- Generating your strings file
- #2. UIWebView
- Using UIWebView
- UIWebView properties
- Loading generated content
- The UIWebView supports a delegate, too
- #3. Device orientation and view rotation
- The view controller tells the iPhone OS what orientations it supports
- Handling view rotations
- Handling rotation with two different views
- #4. View animations
- Animating table view updates
- Animating view and control changes
- #5. Accelerometer
- All you need is the UIAccelerometer
- Understanding the device acceleration
- #6. A word or two about gaming...
- Multitouch
- Quartz and OpenGL
- Quartz
- OpenGL
- Game Kit
- ii. preparing an app for distribution: Get ready for the App Store
- Apple has rules
- Start at the Apple Developer Portal
- First get your Development Certificate
- The Provisioning Profile pulls it all together
- Keep track in the Organizer
- A few final tips...
- Index
- Symbols
- A
- B
- C
- D
- E
- F
- G
- H
- I
- K
- L
- M
- N
- O
- P
- Q
- R
- S
- T
- U
- V
- W
- X
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.