Before ios 5 I would set the row height in a tableview like this:
self.tableView.rowHeight=71;
However, it doesn’t work on iOS5.
Someone has an idea?
Thanks
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.
Have you tried
tableView:heightForRowAtIndexPath:fromUITableViewDelegate?You may set the row height to 71 by implementing
tableView:heightForRowAtIndexPath:in yourUITableViewdelegate (one who supports theUITableViewDelegateprotocol).First you should set a delegate of your tableView. Delegate should conform to the
UITableViewDelegateprotocol. Let’s say we have aTableDelegateclass. To conform to aUITableViewDelegateprotocol one should have it in square brackets in it’s declaration like this:Then you set the delegate:
In the end you should implement the
tableView:heightForRowAtIndexPath:method in theTableDelegateimplementation:rowHeight
Just to clarify, using
rowHeightshould work just fine and perform better than constant returned from-tableView:heightForRowAtIndexPath:as Javier Soto points out in the comments. Also note, that if your UITableView has delegate returning height in-tableView:heightForRowAtIndexPath:androwHeightproperty set, prior value is honoured.