ios - Swift: UITextfield affecting button click? Unable to enter text due to animation? -


i having odd problem uiview animations , uitextfield - need able click button, have button animate reveal textfield user can enter text in text field, when user presses button again user interaction disabled on text field , button moves over.

this mean- enter image description here

i have accomplished extent placing textfield behind button , disabling @ start, when button clicked button animates reveal text field, becomes enabled:

enter image description here

problem button click being triggered (or possibly animation) when user goes edit text field. when go type, button moves down , covers text field.

this odd because have boolean set whether button moves or down, , not think being flipped because button moves below textfield, should never happen.

here how i'm doing this:

@ibaction func entertext(sender: uibutton) {         print("time enter text")          if !textopen         {         uiview.animatewithduration(0.5, animations: {             self.textbtn.center.y -= self.textbtn.bounds.height         })          happenedtxt.userinteractionenabled = true         }         else {             uiview.animatewithduration(0.5, animations: {                 self.textbtn.center.y += self.textbtn.bounds.height             })          happenedtxt.userinteractionenabled = false             }          textopen = !textopen     } 

how can trigger button move when button pressed? why textfield triggering animation? there call being made return button original position?