@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 でコールバックします
リーリー最初の方法を使用して画像を取得してください~