【问题标题】:Alignment UIImageView to left with Aspect Fit in xib将 UIImageView 与 xib 中的 Aspect Fit 对齐
【发布时间】:2015-12-10 13:03:41
【问题描述】:

我想将 UIImageview 中的图像向左对齐。我正在使用 Aspect 拟合模式。我如何使用自动调整约束来实现目标。 我所做的是as

我想把这个小标志放在左边。

有没有办法使用约束和支柱来设置它。我想要这样

【问题讨论】:

  • 什么是橙色?
  • 橙色是空间??
  • 橙色的是imageview。
  • 是的。 .它是imageview的空闲空间
  • 图片是静态的还是动态的?

标签: ios xcode xib


【解决方案1】:

我已经以编程方式完成了。但仍然要使用 ui-builder 设置这些约束。如果有人知道,请与我们分享您的知识。

CGFloat desiredHeight = .20 * self.logoImagesContainer.frame.size.height;
CGFloat scaleFactor = image.size.height/desiredHeight;
CGFloat desiredWidth = image.size.width / scaleFactor;
self.logoImageView.frame = CGRectMake(0, 0, desiredWidth, desiredHeight);

【讨论】:

    猜你喜欢
    • 2011-03-17
    • 2011-12-26
    • 1970-01-01
    • 1970-01-01
    • 2015-07-29
    • 2018-06-06
    • 1970-01-01
    • 1970-01-01
    • 2020-06-17
    相关资源
    最近更新 更多