I need to add a gesture (move, rotate, scale) to a UIButton
.
I created the button in code, but I don\'t know how to use it.
If the button is touched I want to mov
I need to add a gesture (move, rotate, scale) to a UIButton.
I'm not sure I understand what you mean about adding a gesture. Right now, your buttons aren't set up to do anything at all.
I created the button in code, but I don't know how to use it.
You need to add a target and action to your button. When a button is tapped, it sends an action message to some other object, which is its target. To set up a button, you need to add a target and action using the -addTarget:action:forControlEvents:
method inherited from UIControl
. If you want the button to send a move
message to the same object that's creating the button, you'd change your addButton
method to include this:
[buttonImage1 addTarget:self action:@selector(move) forControlEvents:UIControlEventTouchUpInside];