Answer the question
In order to leave comments, you need to log in
Handling button clicks?
Good day everyone! This question arose when designing the application:
There are, for example, 10 buttons. You need to "respond" to pressing any of the buttons. I know how to respond to pressing a certain button (right-click - drag it to the implementation).
But how to create a click event on any of the buttons and when you click on it, for example, display its text in a text label?
In jQuery, this is $(this) or setting onclick="func()" on each element, and then define this func()
Answer the question
In order to leave comments, you need to log in
If you do it through code, then you create a button and then bind an action to it.
UIButton *button = [[UIButton alloc] init];
[button addTarget:self action:@selector(pushButton:) forControlEvents:UIControlEventTouchUpInside];
- (void)pushButton:(id)sender{
//code
}
- (IBAction)refresh:(id)sender{
//Code
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question