简体   繁体   English

滚动视图栏滚动而内容视图不滚动

[英]ScrollView bars scroll while Content View does not

I am writing an application to digitally sign consent forms for a business. 我正在写申请以数字方式签署企业的同意书。 In storyboard, I have three views... The main view, a scroll View inside the main view, and then a content view inside the scroll view. 在情节提要中,我有三个视图...主视图,主视图内的滚动视图,然后是滚动视图内的内容视图。

Inside the content view I have multiple labels and buttons. 在内容视图中,我有多个标签和按钮。 Everything works exactly as it should except for the scroll. 除滚动外,其他所有功能均按其应有的方式工作。 I can see the scroll bar moving on the right, but the content view does not change. 我可以看到滚动条在右侧移动,但是内容视图没有改变。 Here are the constraints that I have for the scroll view as well as the content view 这是我对滚动视图和内容视图的约束

约束

And here is a gif of what's happening to get an idea. 这是获得想法的过程的图像。 Seems like no matter what constraints I set, the same thing always occurs. 似乎无论我设置了什么约束,总是会发生同样的事情。

GIF显示问题

There is more stuff at the bottom as you can see in this storyboard image. 在此故事板图像中,您可以在底部看到更多内容。

情节提要全视图

  1. You just need safe area for the root view, so you can remove safe area of My View by selecting it and open Size Inspector then uncheck Safe Area Layout Guide 您只需要根视图的安全区域,因此可以通过选择“ My View并打开“ Size Inspector来删除“安全区域”,然后取消选中“ Safe Area Layout Guide

    在此处输入图片说明

  2. Set Content View constraints: top, bottom, right, left, equal width to My View . 设置Content View约束:上,下,右,左,等宽于“ My View You notice now there no more Safe Area guide inside My View . 您会发现“ My View没有其他Safe Area指南。

    在此处输入图片说明

Alright, thanks to Niall Kehoe, I noticed that it had two safe areas in story board. 好了,感谢Niall Kehoe,我注意到故事板上有两个安全区域。 Therefore I went ahead and rebuilt the entire view from scratch. 因此,我继续从头开始重建整个视图。 It wasn't fun, but after setting the constraints the right way, everything started working like it should. 这不是很有趣,但是在以正确的方式设置了约束之后,一切都开始按预期运行。

Seems like there was an issue when I was initially putting it all together and constraints were most likely confused by seeing two Safe Areas. 当我最初将所有内容放在一起时,似乎出现了一个问题,并且看到两个安全区域很可能使约束变得混乱。 Super annoying, but I'm glad I was able to get it fixed. 超级烦人,但我很高兴能够修复它。 Thanks for everyone's help! 感谢大家的帮助!

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

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