【发布时间】:2010-04-15 19:53:50
【问题描述】:
我知道这是一个非常常见的问题,但是每个网站上的所有答案都不起作用!如果你还是不明白我的意思,那么也许这行代码可以帮助你理解。
- (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: 而不是==,但这也没有成功。有什么建议吗?
【问题讨论】:
标签: ios iphone uiimageview uitouch touchesbegan