Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image View in Auto Layout using SDWebImage in Storyboards

I'm having no luck getting an image and its UIImageView to show up the correct size in my custom UITableViewCell. The image is correct, but its place in the UITableViewCell is not, and isn't even close.

I don't have enough reputation points to post images sadly.

I have all the suggested constraints Xcode 6 added or suggested, but the image is showing up huge and in front of everything in my UITableViewCell.

Here's the only code I have related to it.

ViewController.m

    self.tableView.rowHeight = UITableViewAutomaticDimension;
    self.tableView.estimatedRowHeight = 600.0;

        NSString *imageURL = [NSString stringWithFormat:@"%@", standardResolutionLocal.url];

        __weak UITableViewCell *wcell = api2Cell;
        [wcell.imageView
         sd_setImageWithURL:[NSURL URLWithString:imageURL]
         placeholderImage:[UIImage imageNamed:@"320x180.gif"]
         ];

CustomTableViewCell.m

- (void)layoutSubviews {
    [super layoutSubviews];
       [self.imageViewPic setTranslatesAutoresizingMaskIntoConstraints:YES];
}

I'm using iOS 8, Xcode 6, and SDWebImage via CocoaPods. Any help would be appreciated, thanks!

like image 353
SRMR Avatar asked Nov 10 '22 23:11

SRMR


1 Answers

Select your image view and modify the Content Mode as desired - perhaps Aspect Fit will scale it appropriately. If it appears positioned correctly but continues to extend outside the image view bounds, enable Clips to Bounds.

like image 196
Jordan H Avatar answered Dec 21 '22 07:12

Jordan H