Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the reason for the remaining vertical spacing between an "inner"-view and the contentview of an UITableViewCell using Storyboard?

I am using storyboard in an iOS/xcode project with the following simplified "hierarchy" (from top to bottom):

  • ViewController (not a TableViewController for some customizing reasons)
  • View
  • TableView (and some other content that does not matter I think)
  • Cell
  • ContentView
  • "AnyView" (specific type seems to be irrelevant, as the following happens for every item I tried)

When I set the constraints between AnyView and ContentView to Zero Spacing for Top/Bottom/Leading/Trailing there is still quite some "space" between the ContentView and AnyView. (I have never encountered this when doing similar things just programmatically.)

In order to get rid of that spacing I looked for everything in storyboard options that sounded even remotely like spacing / intending etc., but did not really succeed.

By accident I just realized that when I drag & drop a view into the ContentView in a certain way it appears that storyboard sets a negative spacing of -8 that seems to "remove" that spacing. I could just use that number in my constraints, but it seems somewhat random. Does anyone know what the reason for my unwanted spacing might be or if that -8 has a deeper meaning (e.g. maybe Apple is forcing some design guidelines onto storyboard users that way?)?

Thank you very much for any insights!

like image 915
McMini Avatar asked Nov 05 '14 10:11

McMini


1 Answers

In Xcode 6 constraints can be "relative to margin". The margin is set as the normal default spacing to the edge of the screen.

You can turn this off in the "add constraints" button...

enter image description here

Or in the constraint property inspector...

enter image description here

like image 84
Fogmeister Avatar answered Oct 26 '22 23:10

Fogmeister