ios - Allign UIViews differnt when some UIViews are hidden? -
i have following view layouted autolayout.
-------- + --------
the plus icon centered vertically on cell. should different when second icon appears can see on following image:
-------- + x --------
i case both icons should alligined vertically centered space of 5 between them.
i create constraints in code no interface builder or storyboard.
how can achieve autolayout?
it's quite simple, need code
- create outlet constraint, align '+' vertically
- change 'constant' property when 'x' appears on cell
for example
{ if (cell.secondview.hidden == true) { // someconstraint - align constrain, can create throw ib cell.someconstraint.constant = 0; } else { // note 'minus' - move first view cell.someconstraint.constant = -cell.secondview.frame.height } }
Comments
Post a Comment