Search code examples
iosxcodeautolayoutios-autolayoutios11

iOS 11 Beta 2 / Xcode Beta 3 AutoLayout Issue


I am using Autolayout to format a UITableViewCell in storyboard. I have experience using Autolayout and was able to easily setup rules for each item in the cell. It looks great in Storyboard (even when I toggle between different screen sizes), however, when I run the app on a device, all of the items are bunched up in the top left corner of the cell, overlapping each other.

Is there a known error in Autolayout for iOS 11 or am I doing something totally wrong?

Thanks!


Solution

  • I migrated to iOS 11 recently and faced the same issue for a custom cell. Tried too many things but failed. Finally I put below code in my custom cell and it worked for me.

    self.translatesAutoresizingMaskIntoConstraints = true
    

    Hopefully it works for you or any new migrant to iOS 11.