问题
so my storyboard look like this
But when I open on iOS simulator, the item (playing card) is off to the right
What is wrong with the spacing/alignments of Storyboard?
(This is with the most recent iOS 8 and XCode 6)
回答1:
Select the playing card ImageView and press the Align button in the auto layout toolbar.
Check the Horizontal Center in Container, ensuring the value is set to 0, and click Add 1 Constraint.
Then press the Pin button and add a top spacing to nearest neighbour constraint of 0, as so:
回答2:
Add constraints to make it horizontally centered in the view. It will do.
See Apple's document, it will help.
回答3:
I was literally bugging out about this same problem with the same example. I finally figured it out.
First constrain the size of the button. Then with descending contraints: Align center x to center x of button. Align center y to center y of button. BINGO!! Thanks for your input. @Adrian Sluyters. I firth thought the Detail View was a zoomable view, but the constraints simply adjust where the center of the view is. Lesson learned.
See my post: Detail View on Storyboard too zoomed in - creates misaligned objects in simulator
来源:https://stackoverflow.com/questions/27699697/xcode-alignment-spacing-between-storyboard-and-simulator