UIViews 和它们对应的 superviews 中使用的坐标是什么?我有这段代码,我想检测用户可以触摸的“走廊”......类似于这张图片:alt text http://img17.imageshack.us/img17/4416/bildschirmfoto20100721u.png
这是我的代码:
CGPoint touch = [recognizer locationInView:[shuttle superview]];
CGPoint centre = shuttle.center;
int outerRadius = shuttle.bounds.size.width/2;
int innerRadius = (shuttle.bounds.size.width/2) - 30;
if ((touch.x < outerRadius && touch.y <outerRadius)){
NSLog(@"in outer");
if(touch.x > innerRadius && touch.y > innerRadius) {
NSLog(@"in corridor");
}
}
半径约为 500 和 600,touch
x 和 y 分别为 100 和 200...
因此,“走廊中”的 NSLog 永远不会被调用。
谢谢