我得到了X和Y由屏幕上设置的UITapGestureRecognizer,获得位置后,我发现物体接触,所以我把条件,但不起作用。也许我把目标C中的错误条件? Xcode不提供任何错误,但该功能不起作用。逻辑运算符和错误的结果在目标C
-(void)tappedMapOniPad:(int)x andy:(int)y{
NSLog(@"the x is: %d", x);
//the x is: 302
NSLog(@"the y is: %d", y);
//the y is: 37
if((121<x<=181) && (8<y<=51)){ //the error is here
self.stand = 431;
}else if ((181<x<=257) && (8<y<=51)){
self.stand=430;
}else if ((257<x<=330) && (8<y<=51)){
self.stand = 429;
}
NSLog(@"The stand is %d", self.stand);
//The stand is 431
}
我该怎么办?
你甚至可以重新组织parethesis这方式:'if((121
Zaphod
是的,我认为OP在将前两个条件分组在一起后有一些逻辑,所以最好保持这种方式。 –
谢谢,现在它可以工作。 –