【发布时间】:2015-01-27 10:47:47
【问题描述】:
我有两个提要,我想用它们的内容来填充表格视图,但是当我想显示图像时,键是不同的,所以在 cellForRowAtIndexPath 我有:
if ([[stories objectAtIndex:storyIndex] objectForKey:@"url"] ==nil) {
[cell.imag setImageWithURL:[NSURL URLWithString:[[stories objectAtIndex:storyIndex] objectForKey:@"_text"]] placeholderImage:[UIImage imageNamed:@"Alb.png"]];
}
else
[cell.imag setImageWithURL:[NSURL URLWithString:[[stories objectAtIndex:storyIndex] objectForKey:@"url"]] placeholderImage:[UIImage imageNamed:@"Alb.png"]];
但它不起作用。
【问题讨论】:
-
使用这段代码 if ([dictionary objectForKey:key]) { // contains object}
-
放断点打印控制台中的值 [stories objectAtIndex:storyIndex] objectForKey:@"url"] 打印什么值....
标签: ios objective-c uitableview key feed