reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling

To prevent jumping you should save heights of cells when they loads and give exact value in tableView:estimatedHeightForRowAtIndexPath: Swift: var cellHeights = [IndexPath: CGFloat]() func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { cellHeights[indexPath] = cell.frame.size.height } func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { return cellHeights[indexPath] ?? UITableView.automaticDimension } Objective … Read more

What is NSLayoutConstraint “UIView-Encapsulated-Layout-Height” and how should I go about forcing it to recalculate cleanly?

Try to lower the priority of your _collapsedtextHeightConstraint to 999. That way the system supplied UIView-Encapsulated-Layout-Height constraint always takes precedence. It is based on what you return in -tableView:heightForRowAtIndexPath:. Make sure to return the right value and your own constraint and the generated one should be the same. The lower priority for your own constraint … Read more

“Auto Layout still required after executing -layoutSubviews” with UITableViewCell subclass

I encountered the same problem while manually adding constraints in code. In code, I was doing the following: { [self setTranslatesAutoresizingMaskIntoConstraints:YES]; [self addSubview:someView]; [self addSubview:someOtherView]; [self addConstraint:…]; } Hypothesis From what I can tell, the issue is that when you disable translatesAutoresizingMaskIntoConstraints, UITableViewCell starts to use Auto Layout and naturally fails because the underlying implementation … Read more

Getting a “This application is modifying the autolayout engine from a background thread” error?

It needs to be placed inside a different thread that allows the UI to update as soon as execution of thread function completes: Modern Swift: DispatchQueue.main.async { // Update UI } Older versions of Swift, pre Swift 3. dispatch_async(dispatch_get_main_queue(){ // code here }) Objective-C: dispatch_async(dispatch_get_main_queue(), ^{ // code here });