Iphone 带触摸键的uibutton开始

Iphone 带触摸键的uibutton开始,iphone,objective-c,Iphone,Objective C,我使用touchsbegind:withEvent:在屏幕上获得用户的触摸,但当我触摸按钮时,不会调用此方法。有没有办法确定单击了哪个按钮 编辑: -(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { UITouch *touch = [[touches allObjects] objectAtIndex:0]; CGPoint finger = [touch locationInView:self];

我使用
touchsbegind:withEvent:
在屏幕上获得用户的触摸,但当我触摸按钮时,不会调用此方法。有没有办法确定单击了哪个按钮

编辑:

-(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;

}

这是
touchsbegind:withEvent:
方法。我给每个按钮一个标签号。我确实连接了界面生成器中的UI按钮。

请看问题。这正是您需要的。

您是如何着手实施的?我们需要更多的信息。如果你发布了一些代码,也会有帮助,如果你使用InterfaceBuilder,你记得连接插座吗?按钮消耗触摸,不会传递。如果你能告诉我们你想做什么,我们可以帮助你找到一个最佳的解决方案。我尝试制作一个应用程序,可以知道哪个UIButton被按下,或者在UIButton被按下时获取信息,我不想给任何UIButton一个方法,或者给所有UIButton可能重复的thx一个方法,当我使用它时,当按下UIButton时需要发生的方法没有发生