Swift, iOS - have button move up when clicked to display text field? Then move back? -


i know how accomplish in sprite kit normal viewcontroller i'm little lost - right have button , uitextfield set on xib file. right now, when button clicked textfield goes hidden not, great.

problem need have button slide (as in animate up) "reveal" text field when clicked. in textfield underneath button. when button clicked, want button slide down original position. don't know how implement these animations.

here image of need:

enter image description here

so blue button trigger move when clicked. if button pressed blue button moves original position on textfield.

how can accomplish this?

here's option can try if aren't displaying these in uitableview:

  1. setup .xib of possible views in 'expanded' state. give views revealed height constraint (in addition others needed layout view properly), , create outlet height constraints in view controller. additionally, store reference want expanded height of view in view controller.
  2. in viewdidload of view controller set height constraints' constant values 0. cause these views disappear, , other views should fill in gaps leave behind based on constraints.
  3. when 1 of buttons pressed, you'll update views should visible setting height constraint 0 if want them hidden, or value saved earlier if want them shown. after height has been updated, call

    uiview.animatewithduration(howlongtheanimationlasts) {     self.view.layoutifneeded() } 

    which should animate change in height values.

alternatively, try putting options in uitableview , altering height using tableview:heightforrowatindexpath: , reloading cells when heights should change.