How to get the overall height of a UITableViewCell?

I have subclassed UITableViewCell, and in this class I want to get its height. How can I achieve this?

I tried:

self.frame.size.height

but not sure if he gives me the correct height value.

+3
source share
1 answer

You can use either self.bounds.size.height or self.contentView.frame.size.height, depending on what you really need. They often differ by 1.0f, which is the thickness of the table cell separator.

Keep in mind that you can rely on these values ​​mainly on -layoutSubviews, in other words, after the table view sets the frame of the cell.

+6

Source: https://habr.com/ru/post/1741982/


All Articles