我正在尝试以编程方式在一个视图控制器中使用来自 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 框架。但形象并没有延续。
关于我做错了什么的任何想法?