0

私はこのオブジェクトを水平方向ではなく垂直方向にドラッグするのが好きです。

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [[event allTouches] anyObject];
    CGPoint location = [touch locationInView:touch.view];
    if (CGRectContainsPoint(myObject.frame, location)){
    CGPoint xLocation = CGPointMake(location.x, myObject.center.y);
    myObject.center = xLocation;
    }
}
4

1 に答える 1

1
CGPoint yLocation = CGPointMake(myObject.center.x, location.y);
myObject.center = yLocation;
于 2010-05-08T11:45:32.133 に答える