简体   繁体   English

如何知道 tableview 大小 xcode iphone?

[英]how to know tableview size xcode iphone?

- (double) tableSize
{
    double tableSize1=[self tableView:tableViewA numberOfRowsInSection:0]*tableViewA.rowHeight;
    return tableSize1;
}

I use that code to know tablesize, but I want to know easier way to know it.. like tableviewA.size or something like that..我使用该代码来了解 tablesize,但我想知道更简单的方法来了解它.. 像 tableviewA.size 或类似的东西..

example: tableviewA have 20 tableviewcell, I want to know the tableviewA size.. how to know it?例子:tableviewA有20个tableviewcell,我想知道tableviewA的大小..怎么知道呢?

If I do tableViewA.frame.size.height it'll always show 400, which is the height of the table frame, because that's the size of the table view.如果我做 tableViewA.frame.size.height 它总是显示 400,这是表格框架的高度,因为那是表格视图的大小。 I want the size of the whole table including those I need to scroll.我想要整个表格的大小,包括我需要滚动的表格。

For example, if the tableviewA has lots of rows then I want to see a high number例如,如果 tableviewA 有很多行,那么我想看到一个高数字

You can use this - tableView.contentSize.height你可以使用这个 - tableView.contentSize.height

this help?这个帮助?

tableView.frame.size.height

or或者

tableView.frame.size.width

then may be you can use那么也许你可以使用

CGSize tableViewContentSize = tableView.contentSize;

to get the content size.获取内容大小。

then to get the height and width just然后得到高度和宽度

tableViewContentSize.height
tableViewContentSize.width

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

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