2

I need change height of my UITable in runtime, when I change height of my cells.

My tableView is static and cann't scrolling

enter image description here

I change height of my tableView in next method (It is very bad decision on my opinion, so that I ask you to help):

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView == self.tableView) {
        self.tableView.originY = 95;
        self.tableView.height = self.tableView.contentSize.height + 2;
        self.tableViewBottom.originY = tableView.originY + tableView.height + 15;
        self.scrollView.contentSize = CGSizeMake(self.scrollView.width, self.tableViewBottom.originY + self.tableViewBottom.height + 10);
    }
}

Problem with self.tableView where clls may change there size. self.tableViewBottom second tableView and lay under the first.

So I have next:

enter image description here

And when clicked:

enter image description here

Sometimes tableView change there position on y after clicking (you can see that size from image is more that in first case) So I thought that first string in code may help: self.tableView.originY = 95;

enter image description here

And why if I make in storyboard height of 100

enter image description here

My tableView show only one cell, so height of tableView don't change programmatically;

enter image description here

EDIT No one of answer cann\t help me, it\s all about change of height of cell. I think I need update height of uitableview after all cells is displaying. How Can I do it?

user2213271
  • 421
  • 7
  • 16

0 Answers0