Cell animation stop fraction must be greater than start fraction

前端 未结 10 1309
梦毁少年i
梦毁少年i 2020-12-24 06:12

I m using Animation in table view cell...Animation is working fine when cell is totally visible.if any cell is partially visible at that time due to Animation my app is gett

相关标签:
10条回答
  • 2020-12-24 06:48

    I experienced the same problem - exception 'Cell animation stop fraction must be greater than start fraction' in [[self tableView] endUpdates]; I solved it by catching the exception and making the endUpdates second time.

    [[self tableView] beginUpdates];
    @try
    {
        [[self tableView] endUpdates];
    }
    @catch (NSException* exception)
    {
        [[self tableView] endUpdates];
    }
    
    0 讨论(0)
  • 2020-12-24 06:49

    I was getting the same error and crash whenever I would scroll to the bottom of the tableview and try to delete cells and insert sections my solution was to scroll the tableview back to the top before calling [tableview beginsUpdates] using the tableviews content offset. With this solution I didn't have to change my section header or footer at all.

    [self.tableView setContentOffset:CGPointZero animated:NO];
    
    0 讨论(0)
  • 2020-12-24 06:51

    I had the same problem after the ios 7 update : crash appeared during a "deleteRowsAtIndexPaths" for expand/collapse stuff in my table view.

    Surprisingly, I have solved this issue by using heightForHeaderInsection instead of heightForFooterInSection.

    -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
        return 1; // it was 0 before the fix
    }
    
    
    -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
        return 0; // it was 1 before the fix
    }
    
    

    This issue has been reported (https://devforums.apple.com/message/795349).

    0 讨论(0)
  • 2020-12-24 06:52

    I experienced the same crash when trying to use a dummy footer to remove potential "empty" table view cells.

    The solution was to get rid of

    tableView:viewForFooterInSection:
    tableView:heightForFooterInSection:
    

    and replace them with the following, in viewDidLoad :

    tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    
    0 讨论(0)
  • 2020-12-24 06:54

    You can use header of next section my same answer is here

    • create empty section
    • use its header instead of footer

    https://stackoverflow.com/a/12297703/788798

    0 讨论(0)
  • 2020-12-24 06:54

    I solved this bug by calling reloadData() for last section:

    func expandSectionPressed(sender: UIButton) {
        let object = items[sender.tag]
        object.expanded = !object.expanded
        sender.selected = object.expanded
        var indexPaths = [NSIndexPath]()
        for i in 0..<7 {
            indexPaths.append(NSIndexPath(forRow: i, inSection: sender.tag))
        }
        if object.expanded {
            tableView.insertRowsAtIndexPaths(indexPaths, withRowAnimation: .Fade)
        } else {
            // strange crash when deleting rows from the last section //
            if sender.tag < numberOfSectionsInTableView(tableView) - 1 {
                tableView.deleteRowsAtIndexPaths(indexPaths, withRowAnimation: .Fade)
            } else {
                tableView.reloadData()
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题