I need to create a table with custom cell’s, which have different size (Height).
Can i change the size of a row just from one or two cell??
Any idea how??
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.
create a mutable array that contains the heights of all of your rows, if you’ve got multiple sections, you can put multiple arrays inside a mutable array. let’s say you’ve got 2 sections and 2 rows for each, then give your table view controller a property:
in the .m file:
then, in your table view controller .m file, there’s a protocol method that we must make use of, you can implement it like this:
the final step: when you want to change a height for a row, let’s say it’s the row in section 1, row 0, then you can do this:
then the table view’s going to resize the row with a smooth animation, you can explicitly resize and re-layout the views inside the row, but I don’t recommend that, the table view’ll automatically do this for you if you’ve got a custom-xib cell and the autoresizing settings are set properly