iPad用のiOSアプリを開発しています。I コードを使用して、ユーザーがオブジェクトに触れたときを検出しますが、同じコードを使用して、ユーザーがオブジェクトに触れていないときを検出したいと考えています。これはコードです:
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:[touch view]];
if (CGRectContainsPoint(ribbon.frame, location) || CGRectContainsPoint(inferior.frame, location) || CGRectContainsPoint(superior.frame, location) & (pujat==YES)){
pujat=NO;
[UIView animateWithDuration:0.25 animations:^{
superior.frame = CGRectMake(0, 710, 1024,500);
ribbon.frame = CGRectMake(480, 685, 70,70);
inferior.frame = CGRectMake(0, 750, 1024,500);}];
[self.view bringSubviewToFront:inferior];
}
}
では、ユーザーが特定のオブジェクトではなく画面に触れたことをどのように検出できますか?