autolayout - iOS auto-layout unsatisfied constraints due to 0 sized container view -


i put view inside container view constraints:

@"h:|-15-[myview]-15-|" 

and when container view's created, size zero, , code crashes, since cannot satisfy constraint both left/right edges 15 points apart left/right edges of 0 sized container.

is there way have priority of constraints, or there better way this? assume container cannot have frame when created subview.

thanks!

yes, can set priorities constraints.

you have add "@value" after constraint constant so:

@"h:|-15@750-[myview]-15-|"

priority level. constraints have priority level. constraints higher priority levels satisfied before constraints lower priority levels. default priority level required (nslayoutpriorityrequired), means constraint must satisfied exactly. layout system gets close can satisfying optional constraint, if cannot achieve it. priority levels allow express useful conditional behavior. example, used express controls should sized fit contents, unless more important should take precedence. more information priority levels, see nslayoutpriority.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -