ios - When can auto layout infer width and horizontal position? -


i'm trying lay out following simple ui using auto layout: enter image description here

so far, i've set 5 constraints:

  • the left edge of textfield constrained left alignment guide
  • the top edge of textfield contained top alignment guide
  • the right edge of label constrained right alignment guide
  • the top edge of label constrained top alignment guide
  • the right edge of textfield constrained 20 points leading edge of label

based on these constraints, think width of textbook determined size of label, , horizontal layout both implied. indeed how these constraints behave when change size of button, i'm still receiving following warning in xcode:

enter image description here

my question why? width , horizontal position can determined information provided, , providing additional information (like fixed width) mess flexibility of interface.

  • well width can't calculated based on constraints applied.
  • both textfield , label grow , shrink based on content.
  • what happen if @ runtime add more text or increase text(content) of both fields. there ambiguity field fill full , trim.

  • so 1 thing need fixed based on other width can calculated.

  • you can add 1 width constraint add activity.
  • my width constraint less or equal width assign. , priority greater leading.

enter image description here

or want play content hugging priority. changing content hugging priority 1 can make possible label not grow. cocoa autolayout: content hugging vs content compression resistance priority

if don't want add width constraint increasing horizontal hugging of add activity 251 (greater textfield hugging) resolve ambiguous constraint issue.

enter image description here


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -