Access iPhone SDK for iPhone 3.1

How to create an application that initiates the camera and updates the image using the image selected by the camera?

+5
source share
2 answers

Try it.

In the viewDidLoad method, initialize the UIImagePickerController, assign its sourceType property as UIImagePickerControllerSourceTypeCamera and delegate as self.

Define a button in your view controller where, in the click event, get a modal imagepicker view, for example:

[self presentModalViewController:self.picker animated:YES];

here the collector is an UIImagePickerController object.

didFinishPickingMediaWithInfo UIImagePickerController. UIImage , UIImageView ( ImageToSave )

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ 

[[picker parentViewController] dismissModalViewControllerAnimated:YES];
UIImage *img = [info objectForKey:@"UIImagePickerControllerImage"];
ImageToSave.image = img;

}

UIImagePickerControllerDelegate .h .

, .

+1

, self.view = picker.cameraOverlayView ! , , ...

:

[self.navigationController presentModalViewController:picker animated:YES];

, (, , , )

0

All Articles