15-DeviceAPIs

15-DeviceAPIs - CS193P - Lecture 15 iPhone Application...

Info iconThis preview shows pages 1–25. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS193P - Lecture 15 iPhone Application Development iPhone Device APIs Location, Accelerometer & Camera Battery Life & Power Management Announcements • Presence 4 was due last night at 11:59PM ■ Late days: use ’em if you’ve got ’em • Work on final projects! Announcements • Upcoming lectures: ■ Wednesday 5/27: Audio, Video & Web Views ■ Monday 6/1: Special Guest Lecture with Dr. Ge Wang ■ Wednesday 6/3: Unit Testing & Objective-C Fun Today’s Topics • Hardware features ■ Image Picker & Camera ■ Location ■ Accelerometer • Battery Life & Power Management iPhone Device APIs Location, Accelerometer & Camera Justin Santamaria iPhone SW Engineering Lots of Cool Features Device Hardware Camera Device Hardware Core location Device Hardware Accelerometers Limited Simulator Support Image Picker The Image Picker Interface The camera The Image Picker Interface Saved photos The Image Picker Interface The photo library The Image Picker Interface Displaying the interface • UIImagePickerController class ■ Use as-is (no subclassing) ■ Handles all user and device interactions ■ Built on top of UIViewController • UIImagePickerControllerDelegate protocol ■ Implemented by your delegate object Displaying the Image Picker Steps for using • Check the source availability • Assign a delegate object • Present the controller modally Displaying the Image Picker Called from a view controller object if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { UIImagePickerController* picker = [[UIImagePickerController alloc] init]; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.delegate = self; [self presentModalViewController:picker animated:YES]; } Selecting an Image Defining Your Delegate Object The UIImagePickerControllerDelegate protocol • Two methods: - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo;- (void)imagePickerControllerDidCancel: (UIImagePickerController*)picker; Defining Your Delegate Object The accept case- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo { // Save or use the image here. // Dismiss the image picker. [self dismissModalViewControllerAnimated:YES]; [picker release]; } Defining Your Delegate Object The cancel case- (void)imagePickerControllerDidCancel: (UIImagePickerController*)picker { // Dismiss the image picker. [self dismissModalViewControllerAnimated:YES]; [picker release]; } Manipulating the Returned Image Allowing users to edit returned images • If allowsImageEditing property is YES: ■ User allowed to crop the returned image ■ Image metadata returned in editingInfo Manipulating the Returned Image Allowing users to edit returned images The editingInfo dictionary Manipulating the Returned Image - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image...
View Full Document

This note was uploaded on 10/29/2009 for the course CS 193D taught by Professor Staff during the Spring '08 term at Stanford.

Page1 / 106

15-DeviceAPIs - CS193P - Lecture 15 iPhone Application...

This preview shows document pages 1 - 25. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online