我了解UIScrollView
的操作使用 AutoLayout,但在我在互联网上看到的所有情况下,我都没有发现类似的问题,也许这就是解决方案无法正常工作的原因。
我的情况是这样的:
Scroll View
Content View
Login View
在哪里 登录查看我需要一个固定的宽度/高度,垂直和水平居中。这里是我设置的约束:
问题是:当我将模拟器(iPhone 6s)旋转到横向时,我无法滚动并查看所有内容,因为 ScrollView 的内容大小为 375,而我的登录框高度为 420。
对于这种特殊情况,我有什么遗漏吗?
最佳答案
你的约束应该像,ScrollView
- top,bottom,leading,trailing
ContentView (UIView)
- top,bottom,leading,trailing,fixed height,horizontally center in container(center X)
LoginView
- fixed width,fixed height, horizontally center in container(center X) and vertically center in container (center Y)
关于ios - 使用 AutoLayout 在 UIScrollView 中居中固定 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39053259/