1

https://www.dropbox.com/s/su11jck7p9fpmvp/Screenshot%202014-08-28%2019.06.52.png?dl=0 I'm just playing with constraints and get weird problems when doing basic centering.

1) If I center a subview horizontally with the guidelines that appear then 'reset to suggested constraints' or 'add missing constraints', the above screenshot happens in the simulator. Even if I center both horizontally and vertically with Editor>Align - Center Horizontally/Vertically (which has the correct iOS simulation positions), this 'reset' option always converts to those 2 constraint types in the screenshot and thus the weird positions (why does it get converted? :().

2) If I delete the vertical space constraint, the label appears in the correct place horizontally (wtf? how is that related at all?) but of course there is the warning that the vertical position is ambiguous.

Basically it seems to align the top layout guide leading X position to the label, instead of the top layout guide center X position.

I'm in Xcode6beta6. Maybe it's just an Xcode6 problem? Or I'm just derping? Thanks for any insight!

butterywombat
  • 2,069
  • 7
  • 26
  • 44

1 Answers1

0

I don't want to suggest the way you are doing it is wrong but there is another way which seems to work for me.

Place your label and then extend to each side. Then set alignment centre. You can then set your left and right margins and top or bottom based on location. I also tend to set the height just in case.

This has the benefit of handling dynamic text quite nicely.

depicus
  • 301
  • 4
  • 19