これは非常によくある質問であることは承知していますが、すべての Web サイトのすべての回答が機能するとは限りません。それでも意味がわからない場合は、このコード行が理解に役立つかもしれません。
- (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:
の代わりにも使用してみ==
ましたが、うまくいきませんでした。助言がありますか?