gpt4 book ai didi

ios - 使用 xcode 快速适应所有设备的设计

转载 作者:行者123 更新时间:2023-11-29 01:35:39 25 4
gpt4 key购买 nike

我实际上正在开发一个 IOS 应用程序,我想在 ScrollView 中看到一个背景 UIImageView。我的问题是,我正在对这两张图片使用 Images.xcassets。

enter image description here

我的 Controller 有这些限制。

enter image description here

在 iphone6 和 Iphone6+ 上我得到了正确的显示

enter image description here

在 Iphone5 上我得到了带有水平 ScrollView 的显示

enter image description here enter image description here

我可以将背景图像调整到设备屏幕,而无需在 iphone5 上水平滚动吗?

我实际上是在 swift 上使用 Xcode 7.0.1。

更新:

我的 imageview、scrollview 和 rootview 之间宽度相同的屏幕。

enter image description here

另一屏采用swift编程方式。

enter image description here enter image description here

最佳答案

就目前而言,您已将图像添加为 ScrollView 的实际内容。如果它应该与 ScrollView 一起滚动,那很好。如果您根本不想让它滚动,您可以将它放在 ScrollView 后面。

您可以禁用水平滚动,更好的是,向 ImageView 添加约束,使其宽度= ScrollView 的 super View ,即 View Controller 的 Root View 。

完成此操作后,您可能还希望添加“中心”作为 ImageView 的内容模式,或者您想要的任何内容,因为会有额外的内容并且缩放看起来会更糟。如果您的 View 对于所有外形尺寸都不够宽,您可能会被迫使用宽高比填充。

关于ios - 使用 xcode 快速适应所有设备的设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33004185/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com