简体   繁体   English

iOS Swift:滚动子视图不会滚动父视图

[英]IOS Swift: Scrolling child views doesnt scroll the parent view

My iOS app view has a cover Image at top (100% width, 30% height) and a Table for the rest of the screen. 我的iOS应用程序视图顶部有一个封面图像(宽度为100%,高度为30%),屏幕的其余部分为表格。 To acheive this kind of layout, I am using "Container Views" in my view. 为了实现这种布局,我在视图中使用了“容器视图”。 So I have Two Container Views: 1st Container is normal view controller with UIImage. 所以我有两个容器视图:第一个容器是带有UIImage的普通视图控制器。 2nd Container is Table View Controller. 第二个容器是Table View Controller。 This can have many entries. 这可以有很多条目。

When I run this and try to scroll, only the second container scrolls in place. 当我运行它并尝试滚动时,只有第二个容器滚动到位。 1st container remains at the top. 第一个容器保留在顶部。

How can I make the full parent view to scroll instead of just second view. 如何使整个父视图滚动而不是仅第二视图。 (Are container views right bet for this kind of requirement and layout?) (容器视图是否适合这种要求和布局?)

you may create a new cell called "HeaderImageCell", and make the first cell to be "headerImageCell" 您可以创建一个名为“ HeaderImageCell”的新单元格,并使第一个单元格为“ headerImageCell”

"Container Views" is not needed at this point. 此时不需要“容器视图”。

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

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