I'm building a basic table view on iOS 8. I watched the WWDC '14 video on the topic of autosizing cells and am trying to reproduce the concept, but am having some issues. On viewDidLoad: I am calling:
//estimate for my cells though they may vary
self.tableView.estimatedRowHeight = 300.0;
self.tableView.rowHeight = UITableViewAutomaticDimension;
When my view and table load up, performance is ok. When I click on a cell, the program takes me to a detail view. When I hit the back button on that view and return to the table view, that's when things start acting weird. The cells then start 'jumping' while I am scrolling. By jumping I mean that they don't scroll smoothly - they tend to jerk or jump from one place to the next.
I should add that memory is not a concern since the cells are being reused and there is little data in the background. The constraints on my cells (in storyboard file) are also blue and I am seeing no autolayout constraint exceptions in the debugger.
Has anyone else seen this kind of behavior with UITableViewAutomaticDimension? Is it just an Apple bug or is there more to it? Thanks.
I have found weird issue using the line self.tableView.rowHeight = UITableViewAutomaticDimension;
But then, everything came a lot better when I replaced it with the delegates method. In your case would be :
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewAutomaticDimension;
}
- (CGFloat) tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 300.0f;
}
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