List of Figures

Chapter 1. Introducing iOS 4 with iPhone and iPad

Figure 1.1. The iPad and iPhone side by side. The primary difference between the two—the available screen real estate—is readily apparent.

Figure 1.2. Double-clicking Xcode and iOS SDK starts your installation.

Figure 1.3. The SDK includes Xcode (top) and two instances of the iOS Simulator, running in iPad mode (bottom left) and iPhone mode (right).

Figure 1.4. Apple provides you with four layers of frameworks to use when writing iOS programs.

Figure 1.5. This hierarchy graph shows a small selection of the classes available in iOS.

Chapter 2. Learning Objective-C

Figure 2.1. Headers and source code files contain distinctive parts of your Objective-C classes.

Chapter 3. Using Xcode 4

Figure 3.1. The Welcome to Xcode window appears when Xcode launches.

Figure 3.2. Choose a template for your new project.

Figure 3.3. Choose options for your new project.

Figure 3.4. Xcode 4 in a single-window interface, which has the Navigator area on the left pane, the Editor area in the center pane, and the Utility area on the right pane

Figure 3.5. Select the project’s Info.plist file to show details in the Editor area.

Figure 3.6. HelloWorldAppDelegate header file and source file under editor assistant view

Figure 3.7. Build and run the application on the iOS Simulator.

Figure 3.8. Running HelloWorld on the iOS Simulator

Figure 3.9. Interface Builder displaying the MainWindow.xib file. A few fundamental displays in Interface Builder are the nib document window (left), the main Editor pane in the middle, together with the Library pane (right bottom), and the Inspector pane (right top).

Figure 3.10. Inspector pane with Identity tab selected

Figure 3.11. Library pane

Figure 3.12. Contents of the MainWindow.nib file shown on the dock

Figure 3.13. The AppleStock application in the iOS Simulator, running with a web view atop a background image

Figure 3.14. MainWindow.xib under Interface Builder

Figure 3.15. MainWindow.xib file in the center with an image view on the bottom and web view and label added in

Figure 3.16. Using the inspector to update the label’s text, font color, font size, and so on

Figure 3.17. Size tab under the Inspector pane. You can change an object’s position and size from the Size tab.

Figure 3.18. Identity tab under the Inspector window

Figure 3.19. Connection tab showing a web view’s IBOutlets and IBActions

Figure 3.20. Prompt window for adding new files to the project

Figure 3.21. Combining graphics and text can be hard in some programming languages, but under the SDK it can be done entirely with Interface Builder. Here you see a background image with a text overlay.

Figure 3.22. Control-drag from the web view to the app delegate header file to create a new outlet.

Figure 3.23. Dialog box to create the Outlet connection from the nib object to the header file

Figure 3.24. This shows what the final product looks like. An image, a label, and a dynamic web view are put together in Interface Builder with only a single line of code required. This demonstrates how simple it is to build a sophisticated interface with little work by using Interface Builder.

Chapter 4. Xcode and debugging

Figure 4.1. Create a new Objective-C class under iOS.

Figure 4.2. Choose UIView as the subclass option of the new file.

Figure 4.3. Brand-new class makes it easy to display a URL and call it up on the screen. You’ve finished the first step in building a web browser.

Figure 4.4. Create a new nib file under Xcode.

Figure 4.5. Organizer window with the Documentation tab selected

Figure 4.6. Select Automatic DeviceProvisioning under the Xcode Devices Organizer window.

Figure 4.7. Fix-it solutions under Xcode

Figure 4.8. Static analysis under Xcode reports a potential leak for an object.

Figure 4.9. Debugger console window

Figure 4.10. The Debugger window with breakpoints on pause

Figure 4.11. How to print out an object’s details in the Debugger console window

Figure 4.12. Breakpoints Navigator window

Figure 4.13. Launching instruments from Xcode

Figure 4.14. Use Allocations under Instruments to analyze the memory allocations during application runtime.

Figure 4.15. Instruments with Leaks to trace leaked blocks

Chapter 5. Basic view controllers

Figure 5.1. A bare view controller shows view controlling at its simplest: it sits below one object and above another.

Figure 5.2. To hook up a new .xib file to a view controller, enter its name in the view controller’s attributes under NIB Name.

Figure 5.3. Here you can see exactly what autoresizing looks like.

Figure 5.4. A table view controller controls a table view and its collection of cells.

Figure 5.5. A look at the connections automatically created for a controller’s table view

Figure 5.6. Section headers can improve the usability of table views. Here they’re shown in use on both the iPad and iPhone.

Chapter 6. Monitoring events and actions

Figure 6.1. Events are initially sent to the first responder but then travel up the responder chain until they’re accepted.

Figure 6.2. UIEvent objects contain a set of related UITouch objects.

Figure 6.3. Two UITextFields (one of them hidden) and one UILabel, set against an aluminum-colored background on the iPhone, complete the object creation you need for your eventreporter project.

Figure 6.4. You’ll connect six objects that you’ll use to report events.

Figure 6.5. Your event responder uses a few graphical elements to report events as they occur.

Figure 6.6. UIControl objects take standard touch events and turn them into actions that are dispatched by UIApplication.

Figure 6.7. With an IBAction, there’s no code, just a link.

Figure 6.8. A heavily connected view controller will be a pretty normal sight as you gain experience in creating objects visually.

Figure 6.9. A text field and a slider conspire to set the color of the iPhone’s background.

Chapter 7. Advanced view controllers

Figure 7.1. A collection of six objects (at minimum) is required to create a functioning tab bar view controller.

Figure 7.2. Dragging a tab bar controller to the nib display window creates the tab bar interface.

Figure 7.3. You can customize tab bars to make navigation clear and simple.

Figure 7.4. A navigation controller contains at least four objects and may be built into a complex web of interconnections.

Figure 7.5. The Navigation-Based Application template contains two .xib files: one for the main view (top) and one for what appears inside the controller (bottom).

Figure 7.6. The navigation controller shown on both the iPad and iPhone

Figure 7.7. With a few simple commands, a navigation controller’s setup is largely automated. Here you see the titled navigation bar with a titled back button.

Figure 7.8. Several objects are created in a flipside controller.

Figure 7.9. Interface objects can be connected to a variety of different files.

Figure 7.10. Creating a split view–based application

Figure 7.11. The bookmarks application employing a split view

Figure 7.12. SplitViewController view elements

Figure 7.13. A first look at your bookmark application as shown on an iPad in landscape orientation

Figure 7.14. A popover view

Figure 7.15. The prototype for an iPhone application with a table view controller and a detail view controller

Figure 7.16. The prototype for an iPad with a split view controller contains a table view on the left and a detail view on the right.

Chapter 8. Data: actions, preferences, and files

Figure 8.1. This preferences page was built from scratch on the backside of a flipside controller.

Figure 8.2. This look at system settings reveals some of Root.plist’s PreferenceSpecifiers.

Figure 8.3. This display shows how a PSTitleValueSpecifier and a PSMultiValueSpecifier look in Xcode.

Figure 8.4. As seen on an iPhone, in order from top to bottom, a Group, a TextField, another Group, a Switch, a TitleValue, a MultiValue, a ChildPane, a third Group, and a Slider

Figure 8.5. Compiled programs contain several directories full of files.

Figure 8.6. The filesaver application with the keyboard activated on both the iPhone and the iPad

Chapter 9. Data: advanced techniques

Figure 9.1. This menu was created directly from a database.

Figure 9.2. As shown here on the iPhone, the Address Book framework gives you low-level access to contact information.

Figure 9.3. A people picker view controller shown on both the iPad and iPhone

Figure 9.4. Entry box

Figure 9.5. Properties of an Entry

Figure 9.6. Creating a managed object class

Chapter 10. Positioning: accelerometers, location, and the compass

Figure 10.1. The accelerometers measure acceleration in three-dimensional space.

Figure 10.2. Gravity test as shown on the iPad. The ball falls as if pulled by gravity and responds accordingly to changes in the orientation of the device.

Figure 10.3. The Accelerometer Graph shows movement in all three directions.

Figure 10.4. This simple utility shows off locations and distance.

Figure 10.5. An altitude program measures how high you’ve climbed on a mountain of your choice.

Chapter 11. Media: images and the camera

Figure 11.1. Images can be shown in UIImageViews or in UIViews.

Figure 11.2. The image picker is another preprogrammed controller for your use.

Figure 11.3. The collager displays many photos simultaneously.

Figure 11.4. Printing UI on the iPad and iPhone

Figure 11.5. Printer Simulator under the iOS SDK

Figure 11.6. Printer Simulator screenshot

Figure 11.7. iPrint app running on the Simulator for the iPhone and iPad

Chapter 12. Media: audio and recording

Figure 12.1. The MPMediaPickerController

Figure 12.2. A simple media player interface

Figure 12.3. The talkback interface: a simple record/playback application

Chapter 13. Graphics: Quartz, Core Animation, and OpenGL

Figure 13.1. The iPhone does abstract art.

Figure 13.2. As these variant transformations show, order matters. The left picture is untransformed, the middle one is translated and then rotated, and the right one is rotated and then translated.

Figure 13.3. An example of a clipping path in use. The unclipped image is on the left, and the clipped image is on the right.

Figure 13.4. You can change a UIImage without showing it to the user.

Figure 13.5. PhotoDraw can place drawings on pictures.

Figure 13.6. A jet moves across the screen on an iPhone, thanks to Core Animation.

Chapter 14. The web: web views and internet protocols

Figure 14.1. Internet protocols are arranged in a hierarchy.

Figure 14.2. As shown on an iPhone, the thumbnail web views load on the screen.

Figure 14.3. RSS feeds can easily be placed in table views.

Figure 14.4. Complex SDK programs can chain multiple classes.

Figure 14.5. It’s easy to extract data using TouchJSON.

Chapter 15. Peer-to-peer connections using Game Kit

Figure 15.1. The peer-picker interface on both the iPhone and iPad. Using Bluetooth, users can connect to other nearby devices and interact in real time.

Figure 15.2. The GKTennis interface

Chapter 16. Using Event Kit on the iPhone and iPad

Figure 16.1. Calendar app on iPhone and iPad

Figure 16.2. Add the Event Kit framework from the project panel.

Figure 16.3. The Event Kit class structure

Figure 16.4. Birthday application launching on the iPhone and IPad

Figure 16.5. The Birthday application successfully added the new event to the Calendar.

Figure 16.6. EventEditViewController presented as a modal view controller

Figure 16.7. Fetching and displaying events from the device’s Calendar database

Chapter 17. Local and Push notification services

Figure 17.1. Local and push notifications with custom message and badge number

Figure 17.2. The AlarmViewController.xib under Interface Builder

Figure 17.3. The screenshot of the AlarmViewController.xib with button and date picker connected to action methods under Interface Builder

Figure 17.4. The lifecycle of a push notification

Figure 17.5. Configuring the app to receive push notifications

Figure 17.6. Wizard to create a push certificate

Figure 17.7. Provisioning profile form

Figure 17.8. Converting audio files in the terminal

Figure 17.9. Exporting your Apple developer certificate

Chapter 18. The Map Kit framework

Figure 18.1. Adding an MKMapView to your view

Figure 18.2. Connection Inspector for the MKMapView connections

Figure 18.3. Layout of MKMapView with segmented controller set up with appropriate options in Interface Builder

Figure 18.4. mapTypes: (from left to right) MKMapTypeStandard, MKMapTypeSatellite, MKMapTypeHybrid

Figure 18.5. Reverse geocoder output

Figure 18.6. Annotated map

Figure 18.7. MKMapView with custom annotations

Chapter 19. In-app purchasing using Store Kit

Figure 19.1. Managing users in iTunes Connect

Figure 19.2. In App Purchase Test User

Figure 19.3. The form to add a new test user

Figure 19.4. Choosing Manage Your In App Purchases in iTunes Connect

Figure 19.5. Click the Create New button.

Figure 19.6. Setting up wallpaper product pricing in iTunes Connect

Figure 19.7. Creating a test product name and description in iTunes Connect

Figure 19.8. Your in-app purchase list in iTunes Connect

Figure 19.9. The wallpaper store interface as shown on the iPhone

Figure 19.10. Previewing the product in the wallpaper view

Figure 19.11. A purchase confirmation as shown on the iPhone

Figure 19.12. A successful purchase confirmation as shown on an iPhone

Chapter 20. Making money with iAd

Figure 20.1. A successful demonstration of a test iAd banner view inside the view controller

Figure 20.2. Full-screen view controller presented when the user taps the banner ad

Figure 20.3. MyAppViewController.xib file, connecting the textLabel outlet to the label inside the view

Figure 20.4. Dynamically update the banner view size to support both portrait mode and landscape mode.

Figure 20.5. The banner view delegate method notifies you when there’s a new advertisement on the iPad.

Figure 20.6. Hide the banner view when there’s an error in the banner view.

Figure 20.7. Default banner view when an error occurs during advertisement downloading

Figure 20.8. Enable the iAd Advertising Network for your application during the new application submission.

Figure 20.9. Your iTunes Connect page will include the iAd Network when the iAd’s contract is accepted.

Figure 20.10. iAd Network under iTunes Connect

Figure 20.11. Add exclusions to your app.

Chapter 21. Introducing multitasking

Figure 21.1. Multitasking UI on the iPad and iPhone

Figure 21.2. Application’s lifecycle in iOS 4

Figure 21.3. Application moves from the foreground to the background.

Figure 21.4. The application restarts from the background and resumes in the foreground.

Figure 21.5. The Quick application keeps tracking the application’s launch time and updating the table view’s UI whenever the application starts.

Figure 21.6. The application finishes the task in the background and sends out a local notification on the iPad and iPhone.

Chapter 22. Multitasking in depth

Figure 22.1. Significant location updates application running in the background

Figure 22.2. MySong’s view controller UI

Figure 22.3. The audio-playing application when it’s launched on the iPhone and iPad

Figure 22.4. Two remote-control UIs on the iPhone when the audio application is playing in the background

Figure 22.5. The info.plist with the background audio key enabled

Figure 22.6. Remote-control UI of My-Song application on the multitasking dock

Appendix D. Updating current applications for the iPad

Figure D.1. Upgrading your build target for the iPad

Figure D.2. Collage application running on the iPad

Figure D.3. Set the target to collage-iPad 4.3 Simulator.

Figure D.4. Collage application running on the iPad

Figure D.5. Broken interface on the iPad

Figure D.6. Updated IPad Interface

Figure D.7. The collage application in landscape mode

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.199.122