小编kae*_*lum的帖子

RowAnimation问题

大家好.我有一个问题,在UITableView上动画删除和插入.事实是,我有不同的单元格高度,现在大约44.0有135.0.我有uitableviewstylegrouped与不同的部分.每个部分的第一行是分组行.点击我删除除分组行以外的所有行.但是当动画(UITableViewRowAnimationTop)135px高度单元格时,该动画看起来很奇怪.我试图将self.tableview.cellheight设置为135并注释掉tableView:cellHeightForIndexPath-Method.而动画效果很好.或者我在tableView:cellHeightForIndexPath-Method中将每个cellheight设置为135.

看起来动画过程会检查各个部分中第一行的高度,以获取所有后续单元格的动画高度.

有人有点想法吗?


- (void) showhideGroup:(int)group
{   
    NSMutableArray *indexPaths = [[NSMutableArray alloc] init];

    MCGroup *handleGroup = [groups objectAtIndex:group];
    NSMutableArray *groupRows = [visibleGroupData objectForKey:handleGroup.title];

    [self.tableView beginUpdates];

    if (!handleGroup.hidden) {
        int row = 0;
        for(MobileFieldMapping *field in groupRows)
        {
            if (![field.datatype matchesInsensitive:GROUPING_CELL]) 
            {
                NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:group];
                [indexPaths addObject:path];
            }
            row++;
        }

        row = 0;
        for(NSIndexPath *index in indexPaths)
        {
            [groupRows removeObjectAtIndex:index.row-row];
            row++;
        }
        [self.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
        handleGroup.hidden=YES;
    }
    else 
    {
        NSMutableArray *allGroupRows = [groupData objectForKey:handleGroup.title];

        int row = 0; …
Run Code Online (Sandbox Code Playgroud)

iphone height animation row cell

6
推荐指数
1
解决办法
601
查看次数

标签 统计

animation ×1

cell ×1

height ×1

iphone ×1

row ×1