我正在尝试编写一个应用程序来允许一个人在地球图像周围拖动。
touchesmoved
当用户开始拖动他的脚时调用该方法,但从[[ event allTouches] anyObject]
不返回earth
对象,因此它永远不会被拖动,
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch=[[ event allTouches] anyObject];
if ( [touch view] == earth )
{
CGPoint location = [ touch locationInView: self.view];
earth.center=location;
}
}