简体   繁体   English

scrollView不滚动到底部滚动视图上的内容视图不是滚动

[英]scrollView Not Scrolling to bottom And content view on scroll view was not Scrolling

我在viewcontroller中的Scrollview上有工具,如图所示 我在viewcontroller中的Scrollview上有工具,如图所示

i have developed that scroll view as making view of viewController sige 320 & 840 and i placed scrolview and contents 我已经开发了滚动视图作为viewController sige 320和840的视图,我放置了scrollview和内容

   _scrollMainView.showsHorizontalScrollIndicator=NO;
 _scrollMainView.delegate=self;
_scrollMainView.indicatorStyle=UIScrollViewIndicatorStyleWhite;
_scrollMainView.contentSize=CGSizeMake(320, 850);

Your scroll view contents one container view and other views (Collection view and labels) 您的滚动视图内容包含一个容器视图和其他视图(集合视图和标签)

To scroll content as expected your view hierarchy should be like following 要按预期滚动内容,您的视图层次结构应如下所示

  1. Main View 主视图
  2. ScrollView 滚动型

2.1 Container View 2.1容器视图

2.1.1 Other Views which you actually want to display in scroll view (in your case collections views and labels should be in container view) 2.1.1其他您想要在滚动视图中显示的视图(在您的案例集合视图和标签中应该在容器视图中)

If you don't want to use auto layout then you need to fix frame of scroll view and increase height of container to display all other content 如果您不想使用自动布局,则需要修复滚动视图框架并增加容器高度以显示所有其他内容

use auto resizing to set scroll view's frame 使用自动调整大小来设置滚动视图的框架

And if you want to use autolayout then pin scroll view from 4 sides to main view then pin container view from 4 side to scroll view and then add equal heights to scroll view for container 如果你想使用autolayout然后将滚动视图从4面固定到主视图,然后将容器视图从4侧固定到滚动视图,然后添加相等的高度以滚动视图

then select height constraint of container view and decrease its priority to 250 OR add constant height to container view as per your need Now you are good to go 然后选择容器视图的高度约束并将其优先级降低到250 根据需要将恒定高度添加到容器视图现在你很高兴去

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

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