【问题标题】:Image View in Auto Layout using SDWebImage in Storyboards在 Storyboards 中使用 SDWebImage 的自动布局中的图像视图
【发布时间】:2014-12-28 17:41:12
【问题描述】:

我没有运气得到一张图片,它的 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。任何帮助将不胜感激,谢谢!

【问题讨论】:

  • 你可以修复 UIImageView 的大小。
  • ImageView 内容模式 - 宽高比

标签: uitableview uiimageview storyboard sdwebimage


【解决方案1】:

选择您的图像视图并根据需要修改内容模式 - 也许 Aspect Fit 会适当地缩放它。如果它看起来定位正确但继续延伸到图像视图边界之外,请启用 Clips to Bounds。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多