yosifz8
yosifz8

Reputation: 561

uibutton with touchesBegan

I use touchesBegan:withEvent: to get the touches of the user in the screen but when i touch a button this method isn't called. Is there any way to identify which button was clicked?

edit:

-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{

    UITouch *touch = [[touches allObjects] objectAtIndex:0];
    CGPoint finger = [touch locationInView:self];
    int x = finger.x;
    int y = finger.y;

}

This is the touchesBegan:withEvent: method. I gave each UIButton a tag number. And I did connect the UIButton in the interface builder.

Upvotes: 3

Views: 10648

Answers (0)

Related Questions