0
我正在開發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];
}
}
所以,我怎麼能當用戶觸摸屏幕,但沒有一定的物體檢測?
'else'子句? – CodaFi 2013-04-30 22:05:36