Using:
- iOS 5, ARC, StoryBoards.
Have 1 image and text on every cell. Images are not getting resized while scrolling. Have two versions of images image.png and image@2x.png.
The custom cell was managed by drugging UIImageView and UILabel in storyboard.
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
Continent *continent=[self.items objectAtIndex:[indexPath row]];
ContinentCell *cell = (ContinentCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.continentName.text=continent.continentName;
cell.textView.text=continent.countriesHash;
cell.imageView.image=[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:continent.continentImage ofType:@"png"]];
return cell;
}
Where’s the evil? Thank you in advance.
Is expensive. You want to load the image the image asynchronously in the background then present it on the main thread when ready.
Here’s a very rough solution