Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centering in Storyboard

I am a little bit confused by Xcode 6 Storyboard.

The auto layout seems to be a very powerful tool to build UI for different devices. However, no matter what kinds of layout I chose (compact or any height/width) or even uncheck the "Use auto layout" and "Use size classes", what I mapped in the storyboard view always looks different when I am testing (using an iPhone 6).

For example if I left a UIButton at the center of the storyboard, it will be a little right down away from center when appears on my iPhone 6.

Could anyone please give me some help on this. Maybe just for iPhone6 instead of different devices. Thank you very much.

like image 905
Kiba Sun Avatar asked Oct 31 '25 02:10

Kiba Sun


1 Answers

If you simply want to center an UI element check both Horizontal Center in Container and Vertical Center in Container in the storyboard constraints alignment popover.

enter image description here

like image 149
Michael Avatar answered Nov 03 '25 00:11

Michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!