1

I have a master-detail application, where the detail view is a UIWebView object. The interface is set up within a storyboard.

The webView should be displayed edge to edge, so the leading and trailing constraints have a constant of -20. This causes the webView to be clipped on iPhone. The ideal constant for the constraints is -16. This, however, results in white bars on the left and right side when running on iPad.

I thought I could fix by having different constants for different size classes:

Compact width: constraint.constant = -16 | Regular width: constraint.constant = -20

The above does not work because of the UISplitViewController, that is showing master and detail view on iPad. This way, the detail view has a compact width.


By analyzing this problem, I found out that the width of the view itself differs from the screen width on iPhone. It is exactly 8 points wider.

Why is that? Is it a bug or something normal? Is there anything I can do to fix this other than setting my constraints manually?

I am on iOS 9 GM.

mangerlahn
  • 4,746
  • 2
  • 26
  • 50

1 Answers1

1

Try to disable relative to margins of the leading and trailing constraints. And specify the constant to 0.

Fujia
  • 1,232
  • 9
  • 14
  • You are right! You can find a great explanation of the margins, that caused my problem here: http://stackoverflow.com/a/28692783/4113940 - Thank you very much! – mangerlahn Sep 11 '15 at 02:52