Get UITableView cell height

rodrigoalvesvieira

I have an UIViewController that implements both UITableViewDelegate and UITableViewDataSource and I want to load the screen a bit scrolled down (starting from the 2nd cell). In this case, I tried to set tableView.contentOffset to a CGPointMake using a hardcoded height, which was the same value I set in the Storyboard for my cell.

However, I want to dynamically read the height. In my table view every cell has the same size, how can I get its height given that in my controller I have my UITableView instance?

Here is my code:

@IBOutlet var tableView: UITableView!

override func viewDidLoad() {
    // Here instead of 88.0 I wanted something like tableView.cellHeight.
    // Is there something like it? Anyone?

    tableView.contentOffset = CGPointMake(0.0, 88.0)
}
matt

The property you're looking for is called rowHeight. So ask for tableView.rowHeight.

Here are the UITableView docs:

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/#//apple_ref/occ/instp/UITableView/rowHeight

They can be very helpful in these situations.

However, I'm not convinced that this is what you really need; it depends on what you mean by "I want to load the screen a bit scrolled down."

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Uitableview cell dynamic height

From Dev

UITableView with variable cell height: Working in IB but not programmatically

From Dev

UITableView inside UITableViewCell with dynamic cell height

From Dev

Set row height of a UITableView according to the cell in that row

From Dev

How to make fixed height cell on uitableview?

From Dev

Set height of a specific cell in my UITableView

From Dev

Set height of UITableView which contain dynamic Cell Height

From Dev

Get last cell in a UITableview section

From Dev

How to change cell height dynamically in UITableView static cell

From Dev

Android: Height of table cell should get height of previous cell

From Dev

Android: Height of table cell should get height of previous cell

From Dev

How to programmatically increase UITableView cell's height in iPhone?

From Dev

Dynamic UITableView cell height with AutoLayout with Dynamic Type Labels

From Dev

UITableView: How to change cell height dynamically when a button is clicked in it?

From Dev

UITableView dynamic cell heights - reload height for single row

From Dev

Static UITableView, make a single cell with dynamic height in Swift

From Dev

UITableView: How to change cell height dynamically when a button is clicked in it? Swift

From Dev

Unnatural jerk with UITableView whe cell height is changed dynamically

From Dev

UItableview each cell label want to hide and height should be change

From Dev

Dynamic row height in UITableView using custom cell from xib

From Dev

How to get the data from the first cell in a UITableView?

From Dev

How to get the data from the first cell in a UITableView?

From Dev

Get text and button in cell in UITableView - Swift 3

From Dev

Table cell borders get visible when selecting a cell in UITableView in IOS

From Dev

Get Pixel Position of Item or Cell Height in Treeview

From Dev

Get height and width from TableLayoutPanel cell

From Dev

jquery to get the height of withing the table cell

From Dev

Auto-Layout: Get UIImageView height to calculate cell height correctly

From Dev

iOS 7/8 UITableView Cell: Two UILabels with dynamic height with auto layout for variable row height

Related Related

  1. 1

    Uitableview cell dynamic height

  2. 2

    UITableView with variable cell height: Working in IB but not programmatically

  3. 3

    UITableView inside UITableViewCell with dynamic cell height

  4. 4

    Set row height of a UITableView according to the cell in that row

  5. 5

    How to make fixed height cell on uitableview?

  6. 6

    Set height of a specific cell in my UITableView

  7. 7

    Set height of UITableView which contain dynamic Cell Height

  8. 8

    Get last cell in a UITableview section

  9. 9

    How to change cell height dynamically in UITableView static cell

  10. 10

    Android: Height of table cell should get height of previous cell

  11. 11

    Android: Height of table cell should get height of previous cell

  12. 12

    How to programmatically increase UITableView cell's height in iPhone?

  13. 13

    Dynamic UITableView cell height with AutoLayout with Dynamic Type Labels

  14. 14

    UITableView: How to change cell height dynamically when a button is clicked in it?

  15. 15

    UITableView dynamic cell heights - reload height for single row

  16. 16

    Static UITableView, make a single cell with dynamic height in Swift

  17. 17

    UITableView: How to change cell height dynamically when a button is clicked in it? Swift

  18. 18

    Unnatural jerk with UITableView whe cell height is changed dynamically

  19. 19

    UItableview each cell label want to hide and height should be change

  20. 20

    Dynamic row height in UITableView using custom cell from xib

  21. 21

    How to get the data from the first cell in a UITableView?

  22. 22

    How to get the data from the first cell in a UITableView?

  23. 23

    Get text and button in cell in UITableView - Swift 3

  24. 24

    Table cell borders get visible when selecting a cell in UITableView in IOS

  25. 25

    Get Pixel Position of Item or Cell Height in Treeview

  26. 26

    Get height and width from TableLayoutPanel cell

  27. 27

    jquery to get the height of withing the table cell

  28. 28

    Auto-Layout: Get UIImageView height to calculate cell height correctly

  29. 29

    iOS 7/8 UITableView Cell: Two UILabels with dynamic height with auto layout for variable row height

HotTag

Archive