xcode - iOS: Auto Layout: Two buttons side-by-side when there's enough space, otherwise on top of one another -
xcode - iOS: Auto Layout: Two buttons side-by-side when there's enough space, otherwise on top of one another -
looking auto layout solution 2 buttons lie side-by-side when there plenty space so, otherwise (when view displayed limited width) rest on top of 1 another.
i don't know begin think through auto layout. help appreciated!
i'd imagine beingness combo between autolayout , nslayoutconstraint property constant, whereby set constraints in ib/storyboard, , click-drag trailing space container constraint each uibutton onto viewcontroller named iboutlet property. (i.e. myconstraint1, myconstraint2.)
then, upon status can determine limited width (rotation event, adding new view?), set 2 constraint constants same value, e.g. self.myconstraint1.constant = self.myconstraint2.constant = somevalue.
not knowing code, can't tell math of course, nor know reset things to, otherwise, programmatically setting nslayoucontraint.constant should give desired effect of 2 uibutton views overlapping 1 horizontally.
similarly, move them y coordinates differ, utilize similar approach vertical spacing bottom layout constraint 1 or both of buttons.
ios xcode autolayout
Comments
Post a Comment