List of Listings

Chapter 3. Redeveloping web pages for the iPhone

Listing 3.1. Checking the user’s agent to see when an iPhone is browsing

Listing 3.2. Applying style sheets using media detection

Listing 3.3. Scrolling the URL bar chrome off the screen with JavaScript

Chapter 4. Advanced WebKit and textual web apps

Listing 4.1. Using the new CSS web properties to create an attractive box

Listing 4.2. Using transitions to animate changes between styles

Listing 4.3. Scaling a picture to create thumbnails

Listing 4.4. Using animation keyframes

Listing 4.5. A database that saves online data to a local resource

Listing 4.6. Detecting and measuring touches

Listing 4.7. Using WebKit gestures to model pinches and rotations

Listing 4.8. An updating web page that always displays window.orientation

Chapter 5. Using iUI for web apps

Listing 5.1. The headers for an iUI page

Listing 5.2. A toolbar that anchors an iUI page

Listing 5.3. iUI’s default element

Listing 5.4. Other elements defining subpages in your iUI web app

Listing 5.5. Creating a search-like form with the dialog class

Listing 5.6. A search page fragment

Listing 5.7. Panels, rows, and toggles forming another user input model

Listing 5.8. iUI will typically be used as part of a dynamic web page

Chapter 6. Using Canvas for web apps

Listing 6.1. The parts of a basic Canvas page

Listing 6.2. Simple Canvas commands draw quick two-dimensional shapes

Listing 6.3. Bezier curves allow for smooth arcs between two points

Listing 6.4. An example of a rhombus function

Listing 6.5. Instead of a color, you can apply a gradient as a style

Listing 6.6. An animation of a changing rhombus

Chapter 7. Building web apps with Dashcode

Listing 7.1. Automatically setting a gauge based on orientation

Listing 7.2. Modifying an indicator just like other simple objects

Listing 7.3. Creating a tab bar using the stackLayout

Listing 7.4. Updating a single view to look like a multitude of pages

Chapter 8. Debugging iPhone web pages

Listing 8.1. The code for a show-source bookmarklet

Chapter 10. Learning Objective-C and the iPhone OS

Listing 10.1. The @interface directive

Listing 10.2. The @implementation directive

Listing 10.3. The @property directive

Listing 10.4. A sample init method for preparing an object

Chapter 11. Using Xcode

Listing 11.1. main.m, which comes with standard code preinstalled for you

Listing 11.2. The Application Delegate header

Listing 11.3. The Application Delegate object that contains your startup code

Listing 11.4. The iPhone presents... Hello, World!

Listing 11.5. A header file for a new class

Listing 11.6. A source code file for a new class

Listing 11.7. A few app delegate calls

Chapter 12. Using Interface Builder

Listing 12.1. New IBOutlet to link to an Interface Builder object

Listing 12.2. IBOutlet to access the object’s usual properties

Listing 12.3. initWithCoder: is required to initialize Interface Builder objects

Chapter 13. Creating basic view controllers

Listing 13.1. You can add views to an IB-created view controller inside viewDidLoad

Listing 13.2. Enabling autorotation in a view controller

Listing 13.3. After the warm up, creating a table view controller takes a few lines of code

Listing 13.4. An array of selective arrays is perfect for table creation

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

Listing 13.6. To set a section header, define the return in the appropriate method

Listing 13.7. We can see when table cells are selected and act accordingly

Chapter 14. Monitoring events and actions

Listing 14.1. An IB-linked header

Listing 14.2. A collection of methods report touches in UIViews

Listing 14.3. manageTouches, which accepts inputs and changes views

Listing 14.4. A simple button action

Listing 14.5. Adding an action to a control

Listing 14.6. A few commands required to get a UITextField working

Listing 14.7. Accessing a text field and a slider

Chapter 15. Creating advanced view controllers

Listing 15.1. A tab bar controller setup

Listing 15.2. A table for a navigator

Listing 15.3. Activating a navigation controller

Listing 15.4. The flipside toggler

Chapter 16. Data: actions, preferences, files, SQLite, and addresses

Listing 16.1. Creating a grouped table in a flipside controller

Listing 16.2. Follow the table view methods to fill out your preferences table

Listing 16.3. Preferences setup with NSUserDefaults

Listing 16.4. Setting and saving NSUserDefaults

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

Listing 16.6. SKDatabase, a new SQLite3 database class

Listing 16.7. SKMenu, an interface to the SKDatabase class

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

Listing 16.9. The app delegate that glues together these classes

Listing 16.10. An example of looking up information in the Address Book

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

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

Chapter 17. Positioning: accelerometers and location

Listing 17.1. Notification can give you INSTANT access to orientation changes

Listing 17.2. Accessing the UIAccelerometer takes just a few steps

Listing 17.3. A short program that causes an image to respect gravity

Listing 17.4. A low-pass filter isolates gravity in the accelerometers

Listing 17.5. Subtracting out the gravity data leaves you only the movement data

Listing 17.6. A movement reporter that could be applied as a program controller

Listing 17.7. Shake, shake your iPhone

Listing 17.8. Integrating didShake: is simple

Listing 17.9. An application of Core Location for distances

Listing 17.10. You can climb any mountain with your iPhone keeping track for you

Chapter 18. Media: images and sounds

Listing 18.1. UIImageView allows for animated images

Listing 18.2. A UIView’s drawRect: allows you to use lower-level draw commands

Listing 18.3. A view controller manages most of the collage’s tasks

Listing 18.4. A temporary image can be moved about by touches

Listing 18.5. A background view manages the low-level drawing once an image is set

Listing 18.6. A simple invocation of the media player

Listing 18.7. The Audio Toolbox supports the playing of short audio

Listing 18.8. Vibrating the iPhone requires one line of code

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

Listing 19.1. A few arcs drawn inside an existing context

Listing 19.2. A new context created to hold an image

Listing 19.3. A drawing with CGPath

Listing 19.4. Drawing a three-color linear gradient

Listing 19.5. Using bitmaps to edit images

Listing 19.6. Outputting text in Quartz

Listing 19.7. The important bits of a view controller for a photodraw program

Listing 19.8. Preparing a picture for drawing

Listing 19.9. Recording touch events

Listing 19.10. Clearing drawings

Listing 19.11. Drawing from user-created variables

Listing 19.12. A simple implicit animation

Listing 19.13. A simple explicit animation

Chapter 20. The web: web views and internet protocols

Listing 20.1. A simple host name lookup

Listing 20.2. A thumbnail web viewer

Listing 20.3. Calling up Google Maps from the SDK

Listing 20.4. Reading an XML text file

Listing 20.5. Creating a table from an RSS feed

Listing 20.6. Deriving altitude from GeoNames

Listing 20.7. A simple POSTing example

Listing 20.8. Creating form data

Listing 20.9. Using TouchJSON

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

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