我正在尝试以编程方式在一个视图控制器中使用来自UIImagePickerController的图像,并将其作为另一个视图控制器中的imageView。这是viewController A的方法
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
UIImage *image = info[UIImagePickerControllerOriginalImage];
bandCropViewController *viewController = [[bandCropViewController alloc]init];
viewController.imageOriginal = image;
[self dismissViewControllerAnimated:YES completion:^{
// Move to Crop View Controller
[self presentViewController:viewController animated:YES completion:nil];
}];
}
ViewController B看起来像这样:
- (void)viewDidLoad
{
[super viewDidLoad];
imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 100, 320, 280)];
[self.imageView setImage:imageOriginal];
imageView.backgroundColor = [UIColor redColor];
[self.view addSubview:imageView];
}
viewController B正在以红色显示imageView框架。但图像并没有延续下去。
关于我做错了什么的想法?
答案 0 :(得分:0)
强烈推荐this tutorial
它应该可以帮到你。看起来你可能正在做一些不必要的事情
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{