【问题标题】:Failure when adding images to a thumbnail gallery将图像添加到缩略图库时失败
【发布时间】:2010-04-20 19:56:30
【问题描述】:

早上好, 在尝试将缩略图添加到画廊视图时,我一直在四处浏览,试图找出我做错了什么,但无法弄清楚它到底是什么。 我正在尝试使用以下代码将缩略图粘贴到空白视图上:

UIImageView *any = [[UIImageView alloc] initWithFrame:CGRectMake(a,b,70,60)];
any.image = [UIImage imageNamed:selectedThumbPath];
any.tag = 0;
[self.view addSubview:any];

在上面的例子中:

a = 165
b = 150
selectedThumbPath = the full path to a thumbnail ie. /users/Cleverbum/library etc

我正在拔头发,没有错误消息,也没有任何线索说明它为什么不画任何东西。更糟糕的是,这是我唯一没有更改的代码部分之一!

【问题讨论】:

    标签: iphone uiimageview image-gallery


    【解决方案1】:

    不久前我遇到了类似的问题。如果我记得, imageNamed: 似乎只适用于我项目中的图像。尝试查看 imageWithContentsOfFile: 并从该路径传递 NSFile。

    【讨论】:

    • 谢谢,我已经盯着那个看了三个小时了。在把这台电脑扔出窗外之后,你让我免于购买新电脑!
    猜你喜欢
    • 1970-01-01
    • 2017-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-04
    • 1970-01-01
    • 2020-06-24
    • 2012-11-04
    相关资源
    最近更新 更多