调用摄像头 UIImagePickerController *picker = [[UIImagePickerController alloc] init]; if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { picker.sourceType = UIImagePickerControllerSourceTypeCamera; NSArray *temp_MediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType]; picker.mediaTypes = temp_MediaTypes; picker.delegate = self; picker.allowsImageEditing = YES; //NSArray *controllers = [[self navigationController] viewControllers]; [self presentModalViewController:picker animated:YES]; } 实现代理,拍照并存储 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType]; BOOL success; NSError *error; NSString *imageFile = [NSString stringWithFormat:@"%@",[self.notificationDictionary valueForKey:@"ImageFile"]]; if ([mediaType isEqualToString:@"public.image"]) { UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage]; NSFileManager *fileManager = [NSFileManager defaultManager]; success = [fileManager fileExistsAtPath:imageFile]; if (success) { success = [fileManager removeItemAtPath:imageFile error:&error]; } [UIImageJPEGRepresentation(image, 1.0f) writeToFile:imageFile atomically:YES]; } } -(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { [picker dismissModalViewControllerAnimated:YES]; }