首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法显示从照片库中选取的图像

无法显示从照片库中选取的图像
EN

Stack Overflow用户
提问于 2013-04-04 13:00:59
回答 3查看 1.4K关注 0票数 1

我正在使用图像拾取器从照片库中选择照片。当我点击按钮时,它会显示图片库。但是当我点击特定的图片时,它会关闭modalView,图片也不会加载到视图中。

代码:

代码语言:javascript
运行
复制
-(void)showcamera:(id)sender{

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc]init];
    imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    imagePickerController.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;

    [self presentModalViewController:imagePickerController animated:YES];

}


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

    // Dismiss the image selection, hide the picker and

    //show the image view with the picked image

    [picker dismissModalViewControllerAnimated:YES];
    UIImage *newImage = image;


}
EN

Stack Overflow用户

发布于 2013-04-04 13:03:31

代码语言:javascript
运行
复制
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    imgPicked = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
    {
        [imagePickerController dismissModalViewControllerAnimated:YES];
    }
}

在.h中声明此内容

代码语言:javascript
运行
复制
UIImage *imgPicked; 

ViewDidLoad

代码语言:javascript
运行
复制
imgPicked = [[UIImage alloc]init];
票数 1
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15802861

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档