views:

133

answers:

1

Hi! 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 images in the tablecells instead of only text

I would be reeeeally happy with any help!!

Thanks

A: 

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.

luvieere