ios - 在 Storyboard中更改 UIImageView 的大小

标签 ios swift

我的 Storyboard 中的 UIViewController 中有一个 UIImageView 和多个 UIView,但在 iPhone 4s 上,我的 UIImageView 位于另一个 View 上。

编辑:

enter image description here

我想减小我的 UIImageView 的大小并得到这个结果: enter image description here

我怎样才能在 Storyboard 中完成这个而不使用任何代码?

Storyboard中的我的 UIViewController:

enter image description here

最佳答案

这可以通过自动布局实现,这意味着无需代码。您需要根据屏幕的大小调整约束。这称为size-class-specific layout。默认情况下,xCode 使用大小类,但只有一个。要添加更多类,您需要手动执行此操作。这并不像听起来那么技术性,而且相当容易。 Apple 在此处的文档中对其进行了解释:Auto Layout Guide: Size-Class-Specific Layout

关于ios - 在 Storyboard中更改 UIImageView 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45419651/

相关文章:

ios - Swift:发布版本中 assertionFailure 的奇怪行为

swift - 如何将 UIImage 转换为 CVPixelBuffer

ios - 我们可以滚动 UIStackView 吗

iphone - 野外的 NSOperationQueueDefaultMaxConcurrentOperationCount

iOS : animate a uiTabBarItem

iOS - 在不转换为字符串的情况下从 float 中删除尾随零?

ios - 如何使用 NSURlConnection 从 Url 下载图像以保存在手机缓存中

ios - swift :我在主屏幕上吗?

json - JSON 中的值可以是数组和对象

ios - UIAppearance - 工具栏和搜索栏崩溃