使用一个UIToolBarItem按钮关闭并打开UIPopOver吗? [英] Dismissing and Opening a UIPopOver with one UIToolBarItem Button?

查看:87
本文介绍了使用一个UIToolBarItem按钮关闭并打开UIPopOver吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用工具栏上的1按钮打开和关闭UIPopOver.如果我现在立即点击该按钮,则另一个PopOver会与前一个重叠.我希望一个按钮能够关闭并打开我的PopOver.我点击一次,它将打开.我再次点击按钮,它消失了.请告诉我如何.谢谢

I was wondering how I could use 1 button on my ToolBar to open and dismiss my UIPopOver. If I keep tapping the button right now, another PopOver overlaps the previous one. I want ONE button to be able to dismiss and open my PopOver. I tap once, it opens. I tap the button again, it dismisses. Please tell me how. Thanks

推荐答案

在您的按钮点击动作事件中:

In your button tap action event:

if (myPopover.popoverVisible)  //self.myPopover if using property
{
    [myPopover dismissPopoverAnimated:YES];
    return;
}

//continue code here to create/present your MyPopover…

这篇关于使用一个UIToolBarItem按钮关闭并打开UIPopOver吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆