0

I had an app working in Xcode 8. After importing it to Xcode 9, autolayout fails. Multi-line UILabels only showing 1 line. Multi-line UIlabels in the UITableView also show 1 line. I have no constraint issues.

I used something like

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 100 

When I implemented a solution as shown here in the converted project, auto layout failed.

But IF I create a new project in Xcode 9 and implement the same solution as given in link above, auto layout works!

Has anyone encountered such an issue? Is there a way to fix my auto-layout in converted project without re-doing all?

Edit

It looks like someone is facing a similar issue here.

Edit 2017.10.18

A possible solution, somewhat hack-ish; here

ikel
  • 518
  • 2
  • 6
  • 27

1 Answers1

0

After further research, I found the answer from the following post; https://stackoverflow.com/a/28545177/1179312

What happened prior upgrade to XCode9, I did override intrinsicContentSize in an extension to UILabel. I decided NOT to use this but forgot to remove it from my project. Then I upgraded to XCode 9 and confused me a lot.

This led to unpredictable behaviour. The fault was mine. Removing the function was previously overriding intrinsicContentSize fixed the following;

  • autolayout issue
  • multiline label issue
ikel
  • 518
  • 2
  • 6
  • 27