使用故事板中的SDWebImage在自动布局中的图像视图

时间:2014-11-01 15:53:21

标签: uitableview uiimageview storyboard sdwebimage

我没有运气获取图片及其 UIImageView在我的自定义UITableViewCell中显示正确的尺寸。图片是正确的,但是UITableViewCell中的位置不是,甚至不会关闭。

我没有足够的声望点来悲伤地张贴图片。

我已经添加或建议了Xcode 6的所有建议约束,但图像显示在我UITableViewCell的所有内容之前。

这是我与之相关的唯一代码。

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];
}

我通过CocoaPods使用iOS 8,Xcode 6和SDWebImage。任何帮助将不胜感激,谢谢!

1 个答案:

答案 0 :(得分:1)

选择图像视图并根据需要修改“内容模式”-也许Aspect Fit会适当缩放它。如果它看起来正确,但是继续延伸到图像视图范围之外,请启用“限界剪辑”。