I have a UITextField
which animates onto the view controller (moves in from the right hand side onto the view) when I press a button. However, when I press on the UITextField
or any other view, the UITextField
disappears. How can I stop the UITextField
from disappearing. I am using the following code:
@IBAction func joinCircleButton(sender: AnyObject) {
let button = sender as UIButton
joinTextField.frame.origin.x=500
joinTextField.frame.origin.y=100
if (button.frame.origin.x - 75>0){
UIView.animateWithDuration(0.5, animations:{
button.frame = CGRectMake(button.frame.origin.x - 125, button.frame.origin.y,button.frame.size.width, button.frame.size.height)
button.transform = CGAffineTransformMakeScale(0.5, 0.5);
self.joinTextField.frame=CGRectMake(self.joinTextField.frame.origin.x - 325, self.joinTextField.frame.origin.y,self.joinTextField.frame.size.width, self.joinTextField.frame.size.height)
})
}
}
override func viewDidLayoutSubviews(){
joinTextField.center = CGPointMake(joinTextField.frame.origin.x-500, joinTextField.frame.origin.y)
}