简体   繁体   中英

Grouped cell in a tableview has translucent area/padding before next section header. How do I change that?

I'm unashamedly editing this to bump it back up - I'm still stumped by this! :)

I have a grouped tableview. I have custom header views, which the user can tap to expand the cells in that section (see below - apologies but I had to obfuscate the text in the cells).

在此处输入图片说明

When I tap on a section header, the cells for that section are inserted/removed with top animation. Problem is, I can see the cells briefly animating down to their correct place in a small area which I have highlighted in yellow. In the example, it is the cell in blue which I see briefly in the area highlighted in yellow.

This translucent area appears for any section that contains cells. Sections with no cells do not have this translucent area.

The section header view is highlighted in red. It would appear that there is some space or padding between the last cell of the previous section and the next header view.

What is this area, and how do I access it to change the properties so that it's not translucent? ie I don't want to see any cells "flying past" this area to get to their designated section.

If I switch to non-grouped, there is no issue - cells animate in and out without being seen in the background of anywhere else.

Can anyone help me please?

These two methods in UITableViewDelegate might help you:

- (UIView *)tableView:(UITableView *)tv viewForFooterInSection:(NSInteger)section;
- (CGFloat)tableView:(UITableView *)tv heightForFooterInSection:(NSInteger)section;

And in UITableView :

@property(nonatomic) CGFloat sectionFooterHeight

Explicitly returning them will give you more control of the padding in your table view.

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