使用不同类型iphone的自定义单元格计算表格的contentSize.height [英] Calculate the table's contentSize.height with custom cells of different types iphone
问题描述
在我的应用程序中,tableview具有不同高度的不同类型的自定义单元格。我想在这个tableView下面放一个视图,为此我需要计算表contentView的高度,我该怎么做呢?
In my application , the tableview is having different types of custom cells with different heights. I want to put a view below this tableView, for which I need to calculate the table contentView height, how can I do it?
之前我曾经这样做过:(noOfRows * cell_height),但那是静态高度。
Earlier I used to do it like: (noOfRows * cell_height), but that was for static heights.
提前完成。
推荐答案
UITableView是UIScrollView的子类,因此您可以在tableview上使用实例方法contentSize:
UITableView is a subclass of UIScrollView, therefore you can use the instance method contentSize on your tableview:
yourtableView.contentSize.height
应该为您提供tableview内容视图的高度
Should give you the height of your tableview content view
这篇关于使用不同类型iphone的自定义单元格计算表格的contentSize.height的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!