gpt4 book ai didi

来自 UIImagePicker 的 Iphone 图片不显示

转载 作者:行者123 更新时间:2023-11-28 23:18:25 24 4
gpt4 key购买 nike

我有一个 TabBarController,其中一个选项卡有一个 ImageView。此外,我有一个按钮来显示 ImagePicker 和以下代码:

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

[self dismissModalViewControllerAnimated:YES];
[picker release];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
imageView.image = image;
}

但是当调用这个方法时,图像并没有显示在ImageView中。

有什么想法吗?

谢谢

(我已经在单独的 View 中尝试过并且它有效所以我不知道发生了什么)

最佳答案

首先,你首先要关闭你的选择器,你可以尝试:

UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
imageView.image = image;
[self dismissModalViewControllerAnimated:YES];

或者你可以试试这个委托(delegate):

-(void)imagePickerController:(UIImagePickerController *)picker 
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo {

NSData *chosenImage = UIImageJPEGRepresentation(image, 1.0);

yourImage.image = [UIImage imageWithData:chosenImage];

}

关于来自 UIImagePicker 的 Iphone 图片不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4549446/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com