0

我正在尝试以编程方式在一个视图控制器中使用来自 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 框架。但形象并没有延续。

关于我做错了什么的任何想法?

4

1 回答 1

0

强烈推荐这个教程

它应该可以帮助你。看起来你可能在做一些不必要的事情

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

于 2013-04-21T01:46:04.990 回答