1

I have a UITableViewCell and I put two subviews in it in the StoryBoard. I set constraints as follows:

  • The first subview has the leading constraint set to 0 points and width equal to 0.45 of the content view. Height is equal to height of content view,

  • The second subview has the trailing constraint set to 0 points and width equal to 0.3 of content view. Height is equal to height of content view.

With these constraints, I think the placement of views is determined & unambiguous. However I still get the warning of missing leading constraint for second subview which may cause clipping. What do I do?

"warning: Auto Layout Localization: Leading constraint is missing, which may cause overlapping with other views."

EDIT: I already searched and found some answers but found them to be unsatisfactory. Why is there a need to add leading constraint when I have width, trailing, and height constraints in place. One view width is 0.45 while other is 0.3 of total width. Why would there be clipping?

Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
  • Possible duplicate of [How to resolve the Storyboard's warnings on Xcode?](https://stackoverflow.com/questions/46557266/how-to-resolve-the-storyboards-warnings-on-xcode) – Enea Dume Aug 15 '18 at 13:56
  • this question has already an answer. Try making some searches before post a question here. Check this: https://stackoverflow.com/a/46557404/8294374 – Enea Dume Aug 15 '18 at 13:56
  • It doesn't answer my question. Why should there be a need for trailing/leading constraint? – Deepak Sharma Aug 15 '18 at 14:03
  • Does this answer your question? [Xcode 9 - "Fixed Width Constraints May Cause Clipping" and Other Localization Warnings](https://stackoverflow.com/questions/45122691/xcode-9-fixed-width-constraints-may-cause-clipping-and-other-localization-wa) – Leo Gaunt May 29 '20 at 12:28

1 Answers1

0

Xcode can't know if your constraints causing overlapping, because your content at the end can be not the same as in storyboard. You simply add Leading constraint as in answers in comments to questions and warning will be silenced.

Unreal Developer
  • 485
  • 3
  • 11