开发者

UILongPressGestureRecognizer and dismissPopoverAnimated:

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜