我知道这是一个非常常见的问题,但是所有网站上的答案都不起作用!如果你还不明白我的意思,那么也许这行代码会帮助你理解。
- (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 和 more optionsbutton
时,它们(顺便说一下)是 UIImageViews
的时候,它什么也不做。我还尝试使用 isEqual:
而不是 ==
,但这也没有奏效。有什么建议吗?