【发布时间】:2013-09-03 14:31:03
【问题描述】:
所以我有一个 Facebook 好友的 UITableView,对于一个单元格,我想将图像添加到其中。
当我尝试以下代码时:
cell.imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:
[NSURL URLWithString: (@"http://graph.facebook.com/shaverm/picture")]]];
一切正常。虽然这是对图像目标的硬编码,但是当我做这样的事情时:
cell.imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:
[NSURL URLWithString: (@"http://graph.facebook.com/%@/picture", thisFriend.friendID)]]];
当指向链接前的 @ 符号时,它会给我一个警告,指出“未使用表达式结果”。
任何想法为什么会发生这种情况?
我也试过了:
cell.imageView.image = [UIImage imageNamed:thisFriend.friendPhoto];
但这给了我一个“不兼容的指针类型将 UIImage 发送到 NSString 类型的参数”警告。
【问题讨论】:
标签: ios objective-c uitableview uiimage