Strange issue arrived after updating new XCODE 9.2 with iOS 11.2, by calling
let indexPath = IndexPath(item: 0, section: 1)
self.tableViewHome.reloadRows(at: [indexPath], with: .none)
It causes unnecessary jerking the whole TableView, Prior it was very fine with these code.
GIF Image for iOS 11.2
GIF Image for iOS 11.1
How to stop this Jerking, I have to reload only one cell in the tableview among two cells.
Any help will be appreciated.
Thanks
What I understand is if you really want to use auto sizing cell(and all cell are of different sizes) then above solutions doesn't work for iOS 11.2, So what I tried is as below:
Declare variable to store the height of the cell
var cellHeightDictionary: NSMutableDictionary // To overcome the issue of iOS11.2
Initialize in viewDidLoad,
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 125
cellHeightDictionary = NSMutableDictionary()
}
and use like below:
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
cellHeightDictionary.setObject(cell.frame.size.height, forKey: indexPath as NSCopying)
}
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
if cellHeightDictionary.object(forKey: indexPath) != nil {
let height = cellHeightDictionary.object(forKey: indexPath) as! CGFloat
return height
}
return UITableViewAutomaticDimension
}
This works for me, Hope this helps to you too
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