开发者

UILongPressGestureRecognizer and dismissPopoverAnimated:

开发者 https://www.devze.com 2023-02-12 19:18 出处:网络
I have a UIPopover being called when the UILongPressGesture is being fired.UIPopOver appears, displays fine, all is okay with the world.

I have a UIPopover being called when the UILongPressGesture is being fired. UIPopOver appears, displays fine, all is okay with the world.

I want the UIPopover to disappear when the gesture is ended either by the finger lifting or moving. I do this by specifying:

if (longPress.state == UIGestureRecognizerStateEnded) {

        [thePopover dismissPopoverAnimated:YES];
        NSLog(@"you let off");
    }

This doesn't work. NSLog fires but dismissPopover doesn't. Stranger enough, if I build a method that does call dismissPopover and wrap it in a performSelector: withObject: afterDelay: , that works fine unless I put it within

if (longPress.state == UIGestureRecognizerStateEnded) {

        [self performSelector:@sel开发者_Go百科ector(releasePopover:) withObject:thePopover afterDelay:2.0];
        NSLog(@"you let off");
    }

Any thoughts as to why this would be?

0

精彩评论

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

关注公众号