iphone - 使用不同类型iphone的自定义单元格计算表格的contentSize.height

标签 iphone uitableview

在我的应用程序中,表格 View 具有不同类型、不同高度的自定义单元格。我想在这个tableView下面放一个 View ,为此我需要计算table contentView的高度,我该怎么做?

之前我曾经这样做过:(noOfRows * cell_height),但那是针对静态高度的。

提前致谢。

最佳答案

UITableView 是 UIScrollView 的子类,因此您可以在 tableview 上使用实例方法 contentSize:

yourtableView.contentSize.height

应该给你tableview内容 View 的高度

关于iphone - 使用不同类型iphone的自定义单元格计算表格的contentSize.height,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3231525/

相关文章:

iphone - 我的iPhone应用程序信息也如何在其他网站上发布?

iphone - 我如何查看 Xcode 调试器中的对象?

iphone - 添加 subview 后 superview 和parentviewcontroller nil

ios - UITableView 单元格背景颜色在滚动时折叠

iOS:自定义UITableViewCell的实现需要调用super

ios - 应用程序崩溃,说集合表达式类型UIView *'可能不响应'countByEnumeratingWithState:object:count“'

iphone - 是否有任何可用于 Objective-C 的测试 spy 库?

iphone - 有助于解锁 iPhone 的 slider

iphone - 为什么我无法从 UITableView 单元格转至详细 View ?

ios - 将 UICollectionView 的选定索引路径存储在 UITableView 中