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.

cell.imageview.image problem

CanDevCanDev Posts: 63Registered Users
edited October 2011 in iPhone SDK Development
I am loading a table with images. I am populating that table with a plist for information, and images, etc.

The problem I am having is that the cells that dont have an image assigned, are showing up with one anyway. The code I am using is this
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @\"Cell\";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
// init with style indicates cell style
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
//adding image to cell
NSString *path = [[NSBundle mainBundle] pathForResource:[dictionary objectForKey:@\"imageKey\"] ofType:@\"png\"];
UIImage *theImage = [UIImage imageWithContentsOfFile:path];
NSLog(@\"key: %@\", [dictionary objectForKey:@\"imageKey\"]);
cell.imageView.image = theImage;
NSLog(@\"image: %@\", theImage);
return cell;
}


So in my plist, I have only used the key "imageKey" in some of the entries, however, I am getting an image in all my cells
Post edited by CanDev on
«1

Replies

Sign In or Register to comment.