Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the height of a specific row in my UITableView

In my UITableView i've set different heights for different rows using the delegate method: tableView:heightForRowAtIndexPath:

Now given a NSIndexPath, I would like to get the height I've previously assigned for a specific row.

like image 336
aneuryzm Avatar asked Sep 06 '25 13:09

aneuryzm


1 Answers

You can use this

CGRect frame = [tableView rectForRowAtIndexPath:indexPath];
NSLog(@"row height : %f", frame.size.height);

Using frame.size.height you can get height of particular row

Swift 3

let frame = tableView.rectForRow(at: indexPath)
print(frame.size.height)
like image 145
Toseef Khilji Avatar answered Sep 09 '25 14:09

Toseef Khilji