开发者

pinch end or touch up after pinch recognition?

开发者 https://www.devze.com 2023-02-24 11:39 出处:网络
i was just searching for an appropriate event that i can catch. the pinch works well. and following line works only if there was no pinch before

i was just searching for an appropriate event that i can catch. the pinch works well. and following line works only if there was no pinch before

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent*)event 
{
    NSLog(@"---> event");
}

it seems that the pinch eats up the following touch up.

anyhow in this code the touch up is recognized

- (void)scalePiece:(UIPinchGestureRecognizer *)gestureRecognizer
{
    //[self adjustAncho开发者_高级运维rPointForGestureRecognizer:gestureRecognizer];

    NSLog(@"scalePiece");

    if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged) {
        [gestureRecognizer view].transform = CGAffineTransformScale([[gestureRecognizer view] transform], [gestureRecognizer scale], [gestureRecognizer scale]);
        [gestureRecognizer setScale:1];
    }
}

how can i recognize the touch up of the last/second finger after pinching the view? or better said, how can i differentiate between pinch move and pinch end?

cheers


You can use:

if ([gestureRecognizer state] == UIGestureRecognizerStateEnded)

in your pinch function

0

精彩评论

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