Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

How do I get the image to display from this?

lukeirvinlukeirvin Posts: 269Registered Users
I am working on feeding in images from an RSS into a UITableView.

Right now I have it set up so that in each cell I can see the URL that points the image which looks like this:

image



How do I get the image to display in my cell and not this text?

Thanks!
Post edited by lukeirvin on

Replies

  • lukeirvinlukeirvin Posts: 269Registered Users
    I am parsing the RSS so it is broken down to where I can display only the title, or the date published or the description which holds this img src tag.

    Right now I am just using a setText to show the "summary" which is linked to the description in the HTML.

    Should I be using NSData to get the data held in the img src tag?

    I've looked at a few examples such as LazyTableImages from Apple but this still isn't clicking well with me.

    Can someone give me a run through on this please?
  • lukeirvinlukeirvin Posts: 269Registered Users
    Right now my tableview is displaying empty cells.

    In the debugger it shows that I am finding each url and placing them in the appropriate cell.

    The app is set up right now that when I tap on the cell safari will open to the webpage with the image.

    The image is not displaying in the cell though :(

    Here's a bit of my code. I'm betting something else should go here but I'm not sure what:


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

    static NSString *MyIdentifier = @\"MyIdentifier\";

    CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];

    if (cell == nil)
    {
    cell = [[[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
    }

    // Set up the cell
    int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];

    NSDictionary * dictionary = [stories objectAtIndex:storyIndex];
    [cell setLogoImage:[dictionary objectForKey:@\"summary\"]];

    return cell;
    }


    setLogoImage is set in my CustomCell.m file. Here is what I'm doing there:


    -(void)setLogoImage:(NSString*)sender
    {
    if(sender !=nil)
    {
    NSString*downloadURL = [[NSString alloc] initWithString:sender];

    ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:downloadURL]];
    request.delegate=self;
    [request setDownloadCache:[ASIDownloadCache sharedCache]];
    [request setCachePolicy:ASIOnlyLoadIfNotCachedCachePolicy];

    [request startAsynchronous];
    }
    }
Sign In or Register to comment.