简体   繁体   English

嵌入导航控制器时,Xcode Scroll View自动布局问题?

[英]Xcode Scroll View Auto Layout Issue when Embedding with Navigation Controller?

I seem to be having issues when it comes to embedding a scrollview within a navigation controller. 将滚动视图嵌入导航控制器时,似乎出现问题。 So here are the steps I take, and its really easy to replicate the weird error i seem to be getting. 因此,这是我采取的步骤,它确实很容易复制我似乎正在得到的奇怪错误。

1.) Drag and drop a UIViewController 1.)拖放一个UIViewController

2.) Followed by a UIScrollView 2.)之后是UIScrollView

  • add constraints to UIScrollView, 0 on all sides, uncheck constrains to margins. 向UIScrollView添加约束,所有面为0,取消选中对边距的约束。

3.) Drag and drop another View into UIScrollView 3.)将另一个视图拖放到UIScrollView中

  • add constraints to UIScrollView, 0 on all sides, uncheck constrains to margins. 向UIScrollView添加约束,所有面为0,取消选中对边距的约束。
  • Control drag from view into scroll view, make same width and height 控制从视图到滚动视图的拖动,使宽度和高度相同

After the following steps you will see in the following images that the view is not following the constraints I set, for some reason it thinks 0 is +64 from the top of scroll view? 在执行以下步骤之后,您将在以下图像中看到该视图未遵循我设置的约束,由于某种原因,它认为从滚动视图的顶部开始0是+64? Not sure what I'm doing wrong here as it is very annoying visually. 不确定我在做什么错,因为这在视觉上非常令人讨厌。

在此处输入图片说明

在此处输入图片说明

In your view controller's attributes inspector, look for the Adjust Scroll View Insets and Extend Edges Under [Top|Bottom] Bar options. 在视图控制器的属性检查器中,在[顶部|底部]栏选项下查找“调整滚动视图插图和扩展边缘”。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM