[英]UITableView with dynamic height inside UIScrollView:
I have a screen with UINavigationController
and UITabBar
. 我有一个带有
UINavigationController
和UITabBar
的屏幕。 The UINavigationController
screen is a UIView
(in figure below, in red), that haves an image in the top and a UIScrollView
(in figure below, in green). UINavigationController
屏幕是一个UIView
(下图中,红色),在顶部有一个图像,而UIScrollView
(下图中,绿色)是一个UIView
。 The UIScrollView
have two UILabel
("Some text") and a UITableView
that DO NOT ENABLE SCROLLING. UIScrollView
具有两个UILabel
(“某些文本”)和一个不启用滚动的UITableView
。
Every time the list become bigger, i need to enlarge the tableview height, dynamically. 每当列表变大时,我就需要动态地扩大tableview的高度。 At the same time, I think I need to enlarge the
UIScrollView
. 同时,我认为我需要放大
UIScrollView
。 See the image below: 见下图:
How can I define the dynamical height to UITableView
and UIScrollView
? 如何定义
UITableView
和UIScrollView
的动态高度?
My goal is: Every time the list become bigger, the UIScrollView
become bigger too. 我的目标是:每当列表变大时,
UIScrollView
变大。
My environment: 我的环境:
I tried to do this setting just the UItableview height , without success. 我尝试仅通过UItableview height进行此设置,但没有成功。
How can I do this? 我怎样才能做到这一点?
You can calculate the height of table view bin the method 您可以计算表格视图bin的高度的方法
heightForCellAtIndexPath:
in this method you pass the height of each row in this you can calculate height by creating a globale variable and in this variable add the row height each time. 在此方法中,您可以传递每一行的高度,在此方法中,您可以通过创建全局变量来计算高度,并在此变量中每次添加行高。
or you can find it by having no of rows * height of a row in height of a row is constant. 或者您可以通过没有行数找到它*行高在行高中是恒定的。
may this will help you. 可能会对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.