-(IBAction) addPicEvent
{
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
If (! [UIImagePickerControllerisSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
SourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
UIImagePickerController * picker = [[UIImagePickerControlleralloc] init];
Picker. delegate = self;
Picker. allowsEditing = YES;
Picker. sourceType = sourceType;
[SelfpresentModalViewController: picker animated: YES];
}
-(Void) saveImage :( UIImage *) image
{
NSLog (@ "save ");
}
-(Void) imagePickerController :( UIImagePickerController *) picker didFinishPickingMediaWithInfo :( NSDictionary *) info
{
[Picker dismissModalViewControllerAnimated: YES];
UIImage * image = [info objectForKey: UIImagePickerControllerEditedImage];
[SelfperformSelector: @ selector (saveImage :) withObject: image afterDelay: 0.5];
}
-(Void) imagePickerControllerDIdCancel :( UIImagePickerController *) picker
{
[Picker dismissModalViewControllerAnimated: YES];
}
From fanwa Software