0
我想在一個視圖控制器中以編程方式使用UIImagePickerController中的圖像,並讓它是另一個視圖控制器中的imageView。下面是從的viewController的方法的imageView不顯示圖像從UIImagePickerController
- (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乙看起來像這樣:
- (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的幀,因爲它應該的。但形象並沒有結轉。
有什麼想法,我做錯了什麼?
你在哪裏做的ViewController B'故事情節? Xib文件?碼? – rdelmar 2013-04-21 03:30:05
嘗試self.imageOriginal,嘗試NSLog圖像對象在imagePicker委託,看看你是否得到一個適當的圖像。在imagePicker委託嘗試這一點viewController.imageOriginal = [信息objectForKey:UIImagePickerControllerOriginalImage]; – satheeshwaran 2013-04-21 04:57:20