Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
現在、ビューコントローラーとサブビューを備えたプログラムがあります。サブビューには、すべてのタッチ ロジックが配置されています。サブビューの外に指をスライドさせても、touchesMoved メソッドはタッチ情報の処理を停止しません。画面から指を離すまで touchesMoved メソッドが終了しないことはわかっていますが、指がサブビューを離れた後、プログラムにタッチを無視させる方法が必要です。これを行うことができるそのような方法を知っている人はいますか?
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint location = [[touches anyObject] locationInView:yourSubview]; if (CGRectContainsPoint(yourSubview.frame, location)) { //process touch } else { //touch is outside of the subview } }