I'm trying to move a text field to the right when a button is pressed. It works fine, however when I click on another text field or any other element the text field re-appears in its current location. I browsed the internet and found it works when I don't have autolayout enabled, however I need autolayout for setting variable positions. Any advice? Here's the method that moves the box:
- (IBAction)EnterInfo:(id)sender {
CGRect newFrame = _UsernameField.frame;
newFrame.origin.x += 500; // shift right by 500pts
[UIView animateWithDuration:1.0
animations:^{
_UsernameField.frame = newFrame;
}];
}
New code for last question:
- (IBAction)EnterInfo:(id)sender {
[UIView animateWithDuration:1.0
animations:^{
_usernameX.constant = 130;
}];
}