[英][iOS][Objective-c] imagepicker to next controller
- (IBAction)sendPhoto:(id)sender {
[DinsowMiniLogger log:@"Image: %@", self.pickedImage];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:nil];
[[self navigationController] dismissViewControllerAnimated:YES completion:nil];
self.selMediaItem = [self.storyboard instantiateViewControllerWithIdentifier:@"selectmedia"];
[self presentModalViewController:self.selMediaItem animated:YES];
self.selMediaItem.imgMediaSelect.image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
我想將圖像發送到下一個控制器但是出錯
由於未捕獲的異常“ NSInvalidArgumentException”而終止應用程序,原因:“-[UINavigationController imgMediaSelect]:無法識別的選擇器已發送到實例0x15979a00”
更新我將uiimagepickercontroller方法移動到下一個控制器
您的didFinishPickingMediaWithInfo
方法應如下所示。 在執行任何操作之前,您將關閉視圖。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *browsed_Image = [info objectForKey:UIImagePickerControllerOriginalImage];
[picker dismissViewControllerAnimated:YES completion:^{
if (browsed_Image) {
// You can store here your image in UIImage object or directly pass it to next controller.
[btn_UserImage setImage:browsed_Image forState:UIControlStateNormal];
}
}];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.