
i placed uiview of size w=140, h=33 @ position x=16 ,y=20 , applied these constraints.

i want uiview display on half of screen no matter orientation or screen size is.
but result in portrait orientation

and in landscape orientation uiview vanish.
why getting behavior, in autolayout view width & height calculated on bases of constraints.
i managed figure out how achieve looking for. it's rather simple once figure out. firstly, clear constraints. position uiview across of screen so:

then, add constraints 0 superview.

edit: need use multiplier 2 half box size.
then, go size inspector, , select trailing space superview , click edit. you'll presented edit screen, see multiplier property. set 0.5, , voila it'll go middle of screen.

consider adding height constraint, if don't view get's compressed. it's simple. view automatically update, , you'll final result: 
hope helps, julian
Comments
Post a Comment