开发者

IPhone- Rss sample code, modify to display images... PLease help!

I am trying to make app that displays an RSS feed, with text and images into a table, but I am really struggeling with it!

I found a really good [sample code-project][1] that i can really recommend-- but im struggeling getting it to display ima开发者_StackOverflowges in the tablecells instead of only text

I would be reeeeally happy with any help!!

Thanks


Add an UIImageView to your table's cells, and set it's image property to your images. You'd want to do this in your cellForRowAtIndexPath: method:

-(UITableViewCell *)tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  static NSString *MyIdentifer = @“MyIdentifier”;

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];

  if(cell == nil) {
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero 
        reuseIdentifier:MyIdentifier] autorelease];

    UIImageView *imgView = [[UIImageView alloc] initWithFrame: CGRectMake(3,3,75,75)];
    imgView.tag = 7;
  }


  [cell setText: (NSString*)[yourTextArray objectAtIndex: indexPath.row];

  UIImageView *theImgView = (UIImageView*)[cell viewWithTag: 7];
  theImgView.image = (UIImage*)[yourImageArray objectAtIndex: indexPath.row]


  return cell;
}

Check out this article for an asynchronous approach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜