简体   繁体   中英

How to change the height of row at indexPath after table was reloaded?

This question may look weird because there is a method: tableView:heightForRowAtIndexPath . I know, but it is called for every cell when table is loading.

In my case I need to change the height of ROW ( not the height of cell in this row ) at some indexPath. How to do this?

In my UITableViewController as a delegate of cell I have following method:

func calendarEventCellWillChangeItsSize(cell: PLCalendarEventTableViewCell, size: CGFloat, indexPath: NSIndexPath) {

    cell.frame.size.height = size //I can simple change the size of cell

}

The question is:

How to change height of the ROW at any indexPath inside this method?

What is the difference?

在此输入图像描述

The image presents 2 frames: the red one -> for row, the green one ->for cell. When I load table, I set the height 266, but when table is loaded within a cell, I count the cell height, and then I have to change its size. In this case I changed its size to 211. But it changed only cell height, not row for this cell... So there is empty space.

你试过这个:

self.tableView.rowHeight = UITableViewAutomaticDimension;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM