XCode alignment/spacing between Storyboard and Simulator?

懵懂的女人 提交于 2019-12-10 21:33:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!