动态更新 UIMenuController
我的应用程序能够弹出菜单。当按下“全选”按钮时,我想启用“删除”按钮。但是我一直无法让这个工作。
这是一个说明该问题的示例项目。运行它,然后点击“菜单”按钮,按“全选”。 “删除”按钮应立即出现,但仅当您隐藏菜单然后再次显示时才会出现。我该如何解决这个问题?
My application has the ability to pop up a menu. When the "Select All" button is pressed, I want to enable the "Delete" button. However I haven't been able to get this working.
Here is a sample project illustrating the issue. Run it, then tap the Menu button, press Select All. The Delete button should appear immediately, but it only appears when you hide the menu and then show it again. How can I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下面的方法可以解决这个问题:
但是我注意到它的工作不是很可靠,例如当将
animated
设置为NO
时,菜单不会即时更新。The following does the trick:
I've noticed however that it does not work very reliable, for example when setting
animated
toNO
, the menu is not updated on the fly.iOS 5 中已解决此问题 (rdar://problem/8819322)。
This is resolved in iOS 5 (rdar://problem/8819322).