【问题标题】:Iphone: XML image problemiPhone:XML图像问题
【发布时间】:2011-03-04 23:22:09
【问题描述】:

我有一个关于解析 XML 并将其放入表格的问题。我从 RSS 提要中解析了以下元素:titledc:creator附件网址(= 一张图片)。

解析工作正常,我可以看到控制台中显示的所有内容。但是当我尝试将所有内容加载到表格单元中时,除了图像之外的所有内容都会显示出来。所以我认为问题一定出在 RootViewController.m(或 TableCell.m)中的 CellForRowatIndexPath 方法中

我做错了什么?请帮忙!我已经为此苦苦挣扎了好几天,但似乎无法弄清楚!

这是 CellForRowatIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

 static NSString *CellIdentifier = @"Cell";

 WerkTableCell *cell = (WerkTableCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

if (cell == nil) {
        [[NSBundle mainBundle] loadNibNamed:@"WerkCell" owner:self options:nil];
            cell =self.werkCell;
                 }
// Configure the cell.
NSMutableArray *cont= [xmlcont items];// is niet in tablevb v. PS

ItemData *current =[cont objectAtIndex:indexPath.row];

cell.titelLabel.text = [current titel];
cell.makerLabel.text = [current maker];
cell.thumbImage.image = [UIImage imageNamed:[current image]];

return cell;
}

【问题讨论】:

    标签: iphone uitableview rss uiimageview nsxmlparser


    【解决方案1】:

    imageNamed: 只会加载本地文件。您的 URL 很可能指向一个远程文件,您必须先从 Web 服务器获取它,然后才能将其加载到表中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-18
      • 2011-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-23
      • 1970-01-01
      相关资源
      最近更新 更多