开发者

drag object vertically

开发者 https://www.devze.com 2022-12-29 08:58 出处:网络
i like to drag this object vertically instead of horizontally, which is doin it now: - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

i like to drag this object vertically instead of horizontally, which is doin it now:

- (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;
    }
}


CGPoint yLocation = CGPointMake(myObject.center.x, location.y);
myObject.center = yLocation;
0

精彩评论

暂无评论...
验证码 换一张
取 消