开发者

Missing animation when calling setEditing:animated: to delete cells from table view

开发者 https://www.devze.com 2023-02-12 05:36 出处:网络
When deleting cells it calls my setEditing:animated: method which i have overridden because I need to adjust the height of my cells when editing, but because of this when I press the edit button the s

When deleting cells it calls my setEditing:animated: method which i have overridden because I need to adjust the height of my cells when editing, but because of this when I press the edit button the slide in animation of the red circles with the minus signs don't occur, instead they just appear into the cell. How Can I fix this?

This is my setEditing:animated code at the moment

- (void)setEditing:(BOOL)editing animated:(BOOL)animated{
[self.tableView setEditing:editing animated:YES];

[self.tableView reloadData];

[super setEditing:editing animated开发者_开发知识库:animated];

}

Any help will be appreciated! Thanks


There's a reload call just for this purpose. Try:

   - (void)setEditing:(BOOL)editing animated:(BOOL)animated{
        [self.tableView reloadRowsAtIndexPaths:[self.tableView indexPathsForVisibleRows] withRowAnimation:UITableViewRowAnimationMiddle];
        [super setEditing:editing animated:animated];
    }


 [self.tblView setEditing:YES animated:YES];
 [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(onLoadTable) userInfo:nil repeats:NO];
-(void) onLoadTable
{
    [self.tblView reloadData];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消