Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was able to find a couple of different things that might be the problem. </p> <p>First it try setting the clipsToBounds property:</p> <pre><code>img1.contentMode = UIViewContentModeScaleAspectFill; img1.clipsToBounds = YES; </code></pre> <p>The second is:</p> <p>The reason you don't see a difference between those modes is that the UITableViewCell automatically sizes its image view to fit the aspect ratio of the image. The content modes only come into play when the view's aspect ratio is different from the image's.</p> <p>Either override layoutSubviews in your custom UITableViewCell class or create an image view yourself (don't use the one that the table view cell provides).</p> <p>EDIT 1:</p> <p>After looking at your code the problem may lie in how your handling your cell configuration. Pointers maybe getting released when they shouldn't. Try these 2 options:</p> <p>Option 1: Keep your current method of passing off configuration to a new method. </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AlbumCell"]; if(cell == nil){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"AlbumCell"]; } return [self configureCell:cell atIndexPath:indexPath]; } - (UITableViewCell*)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { UITableViewCell* returnCell = cell; Album *album = [self.fetchedResultsController objectAtIndexPath:indexPath]; returnCell.textLabel.text = [album.title description]; returnCell.detailTextLabel.text = [self.userVisiableDateFormatter stringFromDate:album.releaseDate]; [returnCell.imageView setContentMode:UIViewContentModeScaleAspectFill]; [returnCell.imageView setClipsToBounds:YES]; [returnCell.imageView setImageWithURL:[NSURL URLWithString:album.coverThumbnailUrl] placeholderImage:[self placeHolderImage]]; return returnCell; } </code></pre> <p>Option 2: (my recommendation) Configure the cell in the delegate method. It's ok to do this here and it's not bad practice. This is delegate method is there to configure the cell. </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AlbumCell"]; if(cell == nil){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"AlbumCell"]; } Album *album = [self.fetchedResultsController objectAtIndexPath:indexPath]; cell.textLabel.text = [album.title description]; cell.detailTextLabel.text = [self.userVisiableDateFormatter stringFromDate:album.releaseDate]; [cell.imageView setContentMode:UIViewContentModeScaleAspectFill]; [cell.imageView setClipsToBounds:YES]; [cell.imageView setImageWithURL:[NSURL URLWithString:album.coverThumbnailUrl] placeholderImage:[self placeHolderImage]]; return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload