hasankose
hasankose

Reputation: 323

UITableViewAutomaticDimension not working until scroll iOS8

After fetch data,i reload tableview. I use automatic dimension don't override heightForRowAtIndexPath like below

self.tableView.estimatedRowHeight = 200; 
self.tableView.rowHeight = UITableViewAutomaticDimension;

Everything is ok in iOS9. But in iOS8 appear like following link until scroll. iOS8 appear

I tried:

  1. [_tableView setNeedsLayout]; [_tableView layoutIfNeeded]; [_tableView reloadData]; After that occur else ui issue in iPhone 6Plus.
  2. I set preferred Width automatic and not marker explicit.
  3. I set uitableviewcell accessory type none.
  4. Tried reload section.
  5. Tried after did display cell, reload table view. After that while scrolling another view controller in page controller, occur same issue.
  6. Tried [cell layoutIfNeeded]
  7. Tried setPreferredMaxLayoutWidth

Upvotes: 1

Views: 946

Answers (1)

Ketan Parmar
Ketan Parmar

Reputation: 27448

Try to reload data in viewDidappear or viewWillappear and check your constraints that it is perfect or not because UITableViewAutomaticDimension strongly recommended autolayout.

Update :

According to comments try to add this two line in cellforrowAtindexpath

[cell layoutIfNeeded];
[cell updateConstraintsIfNeeded];

In order to make UITableViewAutomaticDimension work you have to set all left, right, bottom, and top constraints relative to cell container view. If you missing like this then check that

hope this will help :)

Upvotes: 1

Related Questions