IPhone table view cell style based on cell data?

Well it seems like you can look at your listData object and decide there. So you can try something like this (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier; if (cell == nil) { cell = UITableViewCell alloc initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier autorelease; } NSUInteger row = indexPath row; if (listData objectAtIndex:row isEqualToString:@"bob") { UIImage *image = UIImage imageNamed:@"bob. Png"; cell.imageView.

Image = image; } else if (row Text = listData objectAtIndex:row; cell.textLabel. Font = UIFont boldSystemFontOfSize:15; return cell; }.

Well it seems like you can look at your listData object and decide there. So you can try something like this - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier; if (cell == nil) { cell = UITableViewCell alloc initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier autorelease; } NSUInteger row = indexPath row; if (listData objectAtIndex:row isEqualToString:@"bob") { UIImage *image = UIImage imageNamed:@"bob. Png"; cell.imageView.

Image = image; } else if (row Text = listData objectAtIndex:row; cell.textLabel. Font = UIFont boldSystemFontOfSize:15; return cell; }.

Thanks, appologies as I am a bit new to iOS...I completly overlooked listData objectAtIndex:row – Hoofamon Jul 30 at 20:44.

Maybe you should setup a dictionary that contains the names of the people as the key for the dictionary and the image name as the value. Then you could grab the cell's text and use that as the lookup for the dictionary.

After you set the text: if(cell.textLabel. Text rangeOfString:@"bob". Location!

= NSNotFound) { UIImage *image = UIImage imageNamed:@"bob. Png"; cell.imageView. Image = image; } else { UIImage *image = UIImage imageNamed:@"star.

Png"; cell.imageView. Image = image; }.

Then you could grab the cell's text and use that as the lookup for the dictionary. UIImage *image = UIImage imageNamed:@"bob. UIImage *image = UIImage imageNamed:@"star.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions