为什么我可以在viewWillAppear中更改单元格的框架?

时间:2013-01-21 10:03:45

标签: ios tableview

-(void)viewWillAppear:(BOOL)animated{
    self.cell4.frame = CGRectMake(self.cell4.frame.origin.x, self.cell4.frame.origin.y, self.cell4.frame.size.width, self.cell4.frame.size.height + 60);
    self.cell5.frame = CGRectMake(self.cell5.frame.origin.x, self.cell5.frame.origin.y + 60, self.cell5.frame.size.width, self.cell5.frame.size.height);
}

我发现细胞的框架已经改变了,但是在ui中它没有改变。有什么工作应该吗?

1 个答案:

答案 0 :(得分:0)

中编写代码
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    // set cell's height yourself

}

会解决它。