设置图像,来自NSDictionary,iPhone

设置图像,来自NSDictionary,iPhone,iphone,uiimageview,Iphone,Uiimageview,我在NSDictionary中有图像路径,它类似于(键:image\u path) [productDictionary objectForKey:@“图像路径”] 我能够在同一本词典的标签上设置文本 像 cell.lbl.text=[productDictionary objectForKey:@“somestatus”] 但不知道如何对图像执行相同的操作(在UIImageview上设置) 如何在UIImageview上设置它? 与此相反: cell.imgvQuotes.image=[UII

我在NSDictionary中有图像路径,它类似于(键:image\u path)

[productDictionary objectForKey:@“图像路径”]

我能够在同一本词典的标签上设置文本 像

cell.lbl.text=[productDictionary objectForKey:@“somestatus”]

但不知道如何对图像执行相同的操作(在UIImageview上设置)

如何在UIImageview上设置它? 与此相反:

cell.imgvQuotes.image=[UIImage ImageName:@“static.png”]

我想从字典中设置图像,而不是“static.png”

我有一个解析后的图像URL,就像

//不起作用,仅举一个例子,您可以使用:

id imageName = [productDictionary objectForKey:@"image_path"];
cell.imgvQuotes.image = [UIImage imageNamed:imageName];

您可以使用相同的方法,但可以从字典中获取图像名称,如下所示:

cell.imgvQuotes.image = [UIImage imageNamed:[productDictionary objectForKey:@"image_path"]];

如果字典包含图像名称而不是imagePath,则@Adil的上述回答是正确的

如果字典包含问题中提到的路径(URL)

cell.imgvQuotes.image=[UIImage imageWithContentsOfFile:[productDictionary objectForKey:@“image_path”]