ios - Xcode - Width and Horizontal Position Are Ambiguous -


i'm trying figure out how autolayout works , have run problem don't understand why getting warning "the width , horizontal position ambiguous" view. view bottom thin blue line can see in screenshot of viewcontroller dealing with:

viewcontroller

the arrow , home buttons not have constraints. constraints larger gray view follows:

gray view constraints

the constraints "authors" label follows:

authors label constraints

and constraints blue thin view follows:

blue thin view constraints

i don't understand why getting warning since larger gray view isn't getting warning there doesn't seem difference in how treat 2 views. made sure include constraints on leading , trailing space both of them why horizontal position ambiguous thin blue one? can kind of see why width might ambiguous don't understand why wouldn't ambiguous larger gray view. shouldn't autolayout automatically deal it? want width obvious scale screen size.

its better not put such view inside top bar, below greybar best if doing partition. have resolved way here.

for blue bar:

  1. you giving "bottom space to:", not necessary maintained "height equals:2"
  2. you giving "leading space to" , "align x" thats don't make sense.

solution:

just this->

  1. give "leading space to: superview(greyview)" , "trailing space to: superview(greyview)" both value 0
  2. give "top space to:(authors)" value
  3. and @ last "height equals to: 2" or wish.

enter image description here

constraints of greyview

enter image description here

constraints of label

enter image description here

constraints of blue bar

enter image description here


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -