Ios7 Spritekit和UIKit坐标之间的冲突
我有一个问题,我想应该有一个简单的答案,但我还没有找到!。在我的SKScene中,所有节点都是根据左下角的原点正确定位并沿路径移动的,但是当我收集下面这个视图代码中的用户触摸坐标时,这些坐标是根据UIKit原点左上角返回的。我肯定我错过了一些非常简单的东西;任何帮助都将不胜感激Ios7 Spritekit和UIKit坐标之间的冲突,ios7,coordinates,sprite-kit,Ios7,Coordinates,Sprite Kit,我有一个问题,我想应该有一个简单的答案,但我还没有找到!。在我的SKScene中,所有节点都是根据左下角的原点正确定位并沿路径移动的,但是当我收集下面这个视图代码中的用户触摸坐标时,这些坐标是根据UIKit原点左上角返回的。我肯定我错过了一些非常简单的东西;任何帮助都将不胜感激 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *move=[[event allTouches
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *move=[[event allTouches] anyObject];
CGPoint movepoint=[move locationInView:self.view];
[_guide runAction:[SKAction moveTo:[[touches anyObject] locationInNode:self] duration:0.01 ]];
if (recording){
if (_MovePointsArray==NULL) {
_MovePointsArray=[[NSMutableArray alloc]init];
}
[_MovePointsArray addObject:[NSValue valueWithCGPoint:movepoint]];
}
curx=[NSString stringWithFormat:@"%f", movepoint.x];
myXPos.text=curx;
cury=[NSString stringWithFormat:@"%f", movepoint.y];
myYPos.text=cury;
}
替代品
CGPoint movepoint = [move locationInView:self.view];
与
每个人的签名
- (CGPoint)locationInView:(UIView *)view
- (CGPoint)locationInNode:(SKNode *)node
- (CGPoint)locationInView:(UIView *)view
- (CGPoint)locationInNode:(SKNode *)node