views:

24

answers:

1

I'm setting the height of my UITableViewCell as part of the method heightForRowAtIndexPath:. It's working fine, I can see the variable cell heights when the app runs.

However, as part of creating the content in the cell using cellForRowAtIndexPath, I would like to position an image in a certain place depending on the height of the cell.

When trying to access the cell's height, I always get a result of 44px, despite the height being set previously correctly in the heightForRowAtIndexPath method.

I'm using cell.frame.size.height or cell.bounds.size.height - I get the same result. Any ideas why the cell (which is a UITableViewCell) is returning the default height? Does it apply the height from the previous method after I have setup the contents?

+1  A: 

To get the height, just call your own method, passing in tableView and indexPath:

CGFloat height=[self tableView:tableView heightForRowAtIndexPath:indexPath];
Felixs