I have UITableView with cells. When i select cell - height increased, when i select this cell again - height decreased. In method "didSelectRowAtIndexPath" i use this -
NSArray *indArr = [[NSArray alloc] initWithObjects:(NSIndexPath*)[timer userInfo], nil];
[self.tableView reloadRowsAtIndexPaths:indArr withRowAnimation:UITableViewRowAnimationFade];
But "UITableViewRowAnimationFade" animation has faded effect, and cell is flickered. I tried another animations, but they also unsuitable(
How i can avoid this effect and update cell without animation?
Setting the row animation to .None doesn't work - there is still stuff going on and moving about. In my case, some cells changed height, which caused the table view to scroll.
To hold perfectly still, do this:
UIView.performWithoutAnimation({
let loc = tableView.contentOffset
tableView.reloadRows(at: [indexPath], with: .none)
tableView.contentOffset = loc
})
Try this.
UIView.setAnimationsEnabled(false)
self.yourTableView.beginUpdates()
self.yourTableView.reloadRows(at: yourIndexPath, with:UITableViewRowAnimation.none)
self.yourTableView.endUpdates()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With