问题
I'm building an iOS application and would like to have a menu that appears from the bottom and can be opened with an upwards swipe. Doing this programmatically works easily.
Since I would also like to learn how to do this in Interface Builder I gave it a try and now Interface Builder is driving me crazy.
What I did:
- Create a new View Controller in story boards. Add the arrow so that this controller is shown first.
Add a view to the bottom of the View Controller's view. Let's call this view the menu.
Set constraints for the menu: leading space, trailing space and bottom space to superview to 0 and height to 100.
Seems like everything should be fine. But when I run the application, this is what happens:
Yellow is the background colour of the main view and red the background colour of the menu.
Only way to make the menu full width is if I set leading and trailing space to -16. But this does not make any sense to me!
Am I doing something wrong? I don't think this should be that complicated.
来源:https://stackoverflow.com/questions/29875187/why-do-i-have-to-set-trailing-space-to-16-in-interface-builder-to-get-full-scre