ios - 使用 AutoLayout 在 UIScrollView 中居中固定 UIView

标签 ios xcode uiscrollview autolayout

我了解UIScrollView的操作使用 AutoLayout,但在我在互联网上看到的所有情况下,我都没有发现类似的问题,也许这就是解决方案无法正常工作的原因。

我的情况是这样的:

Scroll View
   Content View
      Login View

在哪里 登录查看我需要一个固定的宽度/高度,垂直和水平居中。这里是我设置的约束:

Constraints that I set

问题是:当我将模拟器(iPhone 6s)旋转到横向时,我无法滚动并查看所有内容,因为 ScrollView 的内容大小为 375,而我的登录框高度为 420。

对于这种特殊情况,我有什么遗漏吗?

最佳答案

你的约束应该像,
ScrollView - top,bottom,leading,trailingContentView (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/

相关文章:

ios - Xcode 8 在打开项目后立即崩溃(似乎与场景编辑器相关)

用大括号 "{ }"包裹所选文本的 Xcode 快捷方式

ios - 实现 ScrollView

iphone - UITableView 顶部和底部阴影

objective-c - 有水平的 UIRefreshControl 吗?

ios - 在 iOS 中检测浅色字体

ios - 退出应用程序后未安装应用程序

ios - 将 MP4 流式传输到 iOS 无法与 JWPlayer 和 CloudFront 配合使用

android - 是否有可能为 android + iOS 制作一个实际上只是一个网络应用程序的应用程序?

iphone - xcode 多个目标