确定何时解除UIMenuController? [英] Determine when a UIMenuController is dismissed?

查看:130
本文介绍了确定何时解除UIMenuController?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法确定何时取消UIMenuController?我有一个(不可编辑的)文本区域,我在菜单显示时突出显示,当他们选择一个项目(简单)或取消(不可能?)时,我想取消突出显示它。

Is there a way to determine when a UIMenuController has been dismissed? I have a (non-editable) text area I'm highlighting when the menu is brought up, and I'd like to un-highlight it when they either select an item (easy) or cancel (not possible?)

推荐答案

在状态更改时,UIMenuController会将通知发布到默认的NSNotification中心。您可以订阅它们以在系统隐藏菜单时收到通知:

On state changes UIMenuController posts notifications to the default NSNotification center. You can subscribe to them to get notified when the system hides the menu:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willHideEditMenu:) name:UIMenuControllerWillHideMenuNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didHideEditMenu:) name:UIMenuControllerDidHideMenuNotification object:nil];

这篇关于确定何时解除UIMenuController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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