Я думаю, вам нужно добавить :
в оператор @selector(buttonClicked:)
, поскольку IBAction
s ожидает один (id)sender
атрибут метода.
Вы можете сделать что-то похожее на код ниже.
- (void)buttonClicked:(id)sender {
CGRect frame = button.frame;
frame.origin.x = 500; // new x coordinate
frame.origin.y = 500; // new y coordinate
button.frame = frame;
}
Если вы хотите анимировать его, вы можете добавить блок beginAnimation.
- (void)buttonClicked:(id)sender {
CGRect frame = button.frame;
frame.origin.x = 500; // new x coordinate
frame.origin.y = 500; // new y coordinate
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration: 0.25];
button.frame = frame;
[UIView commitAnimations];
}