0

I'm having problem with using constraints inside a UITableViewCell. I want to place a UIView inside a UITableViewCell just to use the UIView as a frame, so the UITableViewCell looks like a Cell with borders.

The problem is as soon I drop the UIView inside the Cell and click "Add missing constraints", I get a warning: "Layout attributes relative to the layout margin on iOS versions prior to 8.0". I looked for a solution but all the solutions here did not work. When I try to uncheck "Relative to margin" option, like in the top answer to the linked question,the warnings are gone but the UIView covers the full cell. But I want small borders around the UIView. Here are some photos how it's looking right now:

Before I uncheck the "Relative to margin" option in my constraints (Thats how it should look like!) : enter image description here

And after I unchecked them: enter image description here

Can someone help me out? Thanks

EDIT

Thanks to Kris Gellci. I found the solution. After I unchecked the margins box, I had to reset the vertical and horizontal Space constraints. Now it works fine.

Community
  • 1
  • 1
Mike_NotGuilty
  • 2,253
  • 5
  • 32
  • 64

1 Answers1

1

Click on each constraint and make sure that none of them are have the "relative to margin" set on either "First Item" or "Second Item". Unselecting the relative to margin will then require you to reset the constant on the constraint. Attached are some screen shots for reference:

Constraint Property Inspector Constraint Item Properties

Kris Gellci
  • 9,539
  • 6
  • 40
  • 47