List of Listings

Chapter 2. Learning Objective-C

Listing 2.1. Defining the class of Appletree

Listing 2.2. Implementation file for the AppleTree class

Listing 2.3. AppleTree.h

Listing 2.4. AppleTree.m

Chapter 3. Using Xcode 4

Listing 3.1. Main.m file

Listing 3.2. HelloWorldAppDelegate’s header file

Listing 3.3. HelloWorldAppDelegate source code

Listing 3.4. Presenting HelloWorld on the screen

Listing 3.5. Create webView with automatic refresh content from Apple’s stock quote

Chapter 4. Xcode and debugging

Listing 4.1. Header file for the LabeledWebView class

Listing 4.2. Source code file for a new class

Listing 4.3. Using the new class in the app delegate file

Chapter 5. Basic view controllers

Listing 5.1. Add a UILabel to your view controller

Listing 5.2. Create the content array

Listing 5.3. Three methods that control how your table is created and runs

Chapter 6. Monitoring events and actions

Listing 6.1. manageTouches, which accepts inputs and changes views

Listing 6.2. Accessing a text field and a slider

Chapter 7. Advanced view controllers

Listing 7.1. Tab bar controller setup

Listing 7.2. A table for a navigator

Listing 7.3. Activating a navigation controller

Listing 7.4. The flipside toggler

Listing 7.5. Declaring the dataset array for the SplitViewController

Listing 7.6. Populating the dataset for the SplitViewController

Listing 7.7. UITableViewDelegate methods for displaying bookmark data

Listing 7.8. Adding an IBOutlet for your UIWebView

Listing 7.9. Responding to device rotation

Listing 7.10. Displaying a popover view when a button is pressed

Chapter 8. Data: actions, preferences, and files

Listing 8.1. Following the table view methods to fill out your preferences table

Listing 8.2. Preferences setup with NSUserDefaults

Listing 8.3. Setting and saving NSUserDefaults

Listing 8.4. A prototype notepad program that maintains a text field as a file

Chapter 9. Data: advanced techniques

Listing 9.1. SKDatabase, a new sqlite3 database class

Listing 9.2. SKMenu, an interface to the SKDatabase class

Listing 9.3. DatabaseViewController, a database-driven table view controller

Listing 9.4. The app delegate that glues together these classes

Listing 9.5. Looking up information in the Address Book

Listing 9.6. People picker: a simple, graphical way to select contacts

Listing 9.7. Functionality required to call up a new person view controller

Listing 9.8. Declaring the Core Data objects

Listing 9.9. Setter methods for Core Data objects

Listing 9.10. Object model and object context getter methods

Listing 9.11. Saving the managed object context

Listing 9.12. Adding an entity to the database

Listing 9.13. Fetching data

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

Listing 10.1. Movement reporter that could be applied as a program controller

Listing 10.2. Shake, shake your iPhone

Listing 10.3. Detect user gesture with long press gesture recognizer

Listing 10.4. An application of Core Location for distances

Listing 10.5. Keeping track of a mountain climb with your iPhone

Chapter 11. Media: images and the camera

Listing 11.1. Using UIImageView to animate images

Listing 11.2. A view controller, which manages most of the collage’s tasks

Listing 11.3. Moving a temporary image by touches

Listing 11.4. Background view managing low-level drawing when an image is set

Listing 11.5. iPrintViewController header file

Listing 11.6. iPrintViewController implementation file

Chapter 12. Media: audio and recording

Listing 12.1. iPodSampleViewController.h

Listing 12.2. iPodTestViewController.m

Listing 12.3. Initialization code for AVAudioRecorder

Listing 12.4. TalkBackViewController.h

Listing 12.5. TalkBackViewController.m

Listing 12.6. Displaying the video camera

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

Listing 13.1. Using bitmaps to edit images

Listing 13.2. The important bits of a view controller for a PhotoDraw program

Listing 13.3. Recording touch events

Listing 13.4. Drawing from user-created variables

Chapter 14. The web: web views and internet protocols

Listing 14.1. A simple hostname lookup

Listing 14.2. A thumbnail web viewer

Listing 14.3. Reading an XML text file

Listing 14.4. Creating a table from an RSS feed

Listing 14.5. Deriving altitude from GeoNames

Listing 14.6. A simple POSTing example

Listing 14.7. Creating form data

Listing 14.8. Using TouchJSON

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

Listing 15.1. GKPeerPickerControllerDelegate methods

Listing 15.2. Implementing the didChangeState delegate method

Listing 15.3. Implementing the receiveData and send methods

Listing 15.4. GKTennisViewController.h

Listing 15.5. Game initialization

Listing 15.6. Setting up the peer picker and responding to its events

Listing 15.7. sendNetworkPacket method

Listing 15.8. The receiveData method

Listing 15.9. The game loop

Listing 15.10. Methods for user interaction

Chapter 16. Using Event Kit on the iPhone and iPad

Listing 16.1. Adding a new event to Calendar’s database

Listing 16.2. SimpleEventViewController header file

Listing 16.3. Using EventEditViewController and delegate to add a new event

Listing 16.4. Using NSPredicate to search for existing events in the device’s Calendar

Listing 16.5. RootViewController’s header file

Listing 16.6. Fetch tomorrow’s events from Calendar and display the details

Listing 16.7. Fetching events with GCD

Chapter 17. Local and Push notification services

Listing 17.1. Creating a custom local notification based on the count down timer

Listing 17.2. PHP code to send a push notification

Chapter 18. The Map Kit framework

Listing 18.1. View Controller header file with map view

Listing 18.2. Controlling the zoom in and center on the map view

Listing 18.3. Dropping a pin on the center of the map

Listing 18.4. MyAnnotation.h

Listing 18.5. MKAnnotation.m

Listing 18.6. MyAnnotationView.m

Listing 18.7. Adding custom annotations to the map

Chapter 19. In-app purchasing using Store Kit

Listing 19.1. RootViewConroller.h

Listing 19.2. viewDidLoad method of RootViewController.m

Listing 19.3. Requesting product information

Listing 19.4. Delegate methods for UITableView

Listing 19.5. didSelectRowAtIndexPath method for the UITableView

Listing 19.6. WallpaperViewController.h

Listing 19.7. WallpaperViewController.m

Listing 19.8. Delegate methods for Store Kit

Listing 19.9. Store Kit response methods

Listing 19.10. Recording transactions and delivering content

Chapter 20. Making money with iAd

Listing 20.1. Creating the banner view inside the view controller

Listing 20.2. Adding the text label and banner view in MyAppViewController.h

Listing 20.3. Presenting the banner view dynamically when the orientation changes

Listing 20.4. Creating ADBannerView and assigning delegate to view controller

Listing 20.5. Implementing the delegate methods for ADBannerView

Chapter 21. Introducing multitasking

Listing 21.1. Implement QuickAppDelegate to collect user data when app launches

Listing 21.2. Implementing the RootViewController.m file to update the user interface

Listing 21.3. Task completion in the background

Chapter 22. Multitasking in depth

Listing 22.1. RootViewController’s header file and implementation file

Listing 22.2. Implementing location updates in the background

Listing 22.3. Project MySong’s view controller header file

Listing 22.4. MySongViewController.m file

Listing 22.5. Enabling remote-control and handling remote-control event reactions

Appendix D. Updating current applications for the iPad

Listing D.1. Adding compiler directives in collageViewController.m

Listing D.2. Updating the image-view frame in tempImageView.m

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

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