@interface BNRDetailViewController ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIToolbar *toolBar;
@end
@implementation BNRDetailViewController
- (IBAction)takePicture:(id)sender {
UIImagePickerController *imagePicker=[[UIImagePickerController alloc]init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
} else {
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
// 模态形式显示uiimagepickercontroller对象
[self presentViewController:imagePicker animated:YES completion:NULL];
}
@end
UIImagePickerControllerDelegate 中回调一下
只用第一个方法 拿到image就好了~