双击隐藏UIPopoverController

时间:2011-09-12 14:46:16

标签: iphone objective-c uipopovercontroller

我有分割视图应用程序,当然在垂直细节视图中有一个弹出控制器,如何用双击隐藏?感谢

1 个答案:

答案 0 :(得分:2)

您必须添加doubleTap手势识别器并调用dismissPopoverAnimated:

首先声明一个手势识别器并将其配置为您的视图:

 UITapGestureRecognizer * doubleTapGesture = [[UIGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTapCallback:)];
 doubleTapGesture.numberOfTapsRequired = 2;
 [yourView addGestureRecognizer:doubleTapGesture];
 [doubleTapGesture release];

然后实现回调:

- (IBAction) doubleTapCallback: (UITapGestureRecognizer *) sender
{
    [yourPopOverController dismissPopoverAnimated:YES]

}