I have subclassed a UITableViewCell and within this class I want to get it’s height. How can I achieve this?
I have tried:
self.frame.size.height
but not sure if it is giving me the correct height value.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use either self.bounds.size.height or self.contentView.frame.size.height, depending on which you actually need. They often differ by 1.0f which is the thickness of the table view cell separator.
Keep in mind that you can rely on those values mainly in -layoutSubviews, in other words after the table view sets the cell’s frame.