我知道这是一个非常常见的问题,但是每个网站上的所有答案都不起作用!如果你还是不明白我的意思,那么也许这行代码会帮助你理解。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
if (touch.view == nextbutton)
[self performSelector:@selector(next)];
if (touch.view == prevbutton)
[self performSelector:@selector(previous)];
if (touch.view == moreoptionsbutton)
[self performSelector:@selector(moresettings)];
}
nextbutton, prevbutton, and more optionsbutton
顺便说一句,当您触摸 时它不会做任何事情UIImageViews
。我也尝试过使用isEqual:
而不是==
,但这也没有成功。有什么建议么?