4

Why are the the vertical and horizontal center alignments greyed out?

enter image description here

Peter
  • 1,848
  • 4
  • 26
  • 44
  • Any context? It seems weird though. – J.Wang Mar 08 '16 at 11:16
  • I add a brand new UIViewControll, and add one UILabel, still greyed out.. – Peter Mar 08 '16 at 11:19
  • Are you selecting two or more views? I think these constraints only apply to a group of two or more views. – J.Wang Mar 08 '16 at 11:23
  • Yes you are right, thanks! But how do you center one single UILabel with autolayout then? – Peter Mar 08 '16 at 11:29
  • 1
    I normally use `ctrl` drag one view to its container and select **Center Horizontally** or/and *Center Vertically* respectively. (well, _center_ should always to a one-to-one relationship i think) – J.Wang Mar 08 '16 at 11:31
  • @J.Wang Thanks ! You should post it as an answer – franck Mar 16 '16 at 13:17

1 Answers1

0

I know it`s been a while since this question has been asked, but in case someone is still stuck with this problem: If "Add Constrains" is greyed out like in the screenshot above, check the Layout-Settings. Layout should be Inferred (Constrains). Once you change this setting from Autoresizing mask to Inferred (Constrains), the "Add Constrains"-Button is selectable. change the Layout-Setting

JTechnau
  • 19
  • 3