长按是否覆盖iPhone复制菜单标题? [英] Override iPhone copy menu captions on a long-press?

查看:116
本文介绍了长按是否覆盖iPhone复制菜单标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当iPhone用户长按某些文本时,是否可以覆盖复制"菜单中的字幕?本质上,我想将文本更改为创建便笺"之类的内容,而不是复制"之类的内容.有可能吗?

Is it possible to override the captions in the "Copy" menu when the iphone user long-presses on some text? Essentially, I'd like to change the text to something like "Create a Note" instead of "Copy". Is that possible?

推荐答案

您可以通过UIMenuController的menuItems属性添加自定义菜单,例如:

You can add custom menus via UIMenuController's menuItems property, something like:

UIMenuItem* item1 = [[UIMenuItem alloc] initWithTitle:@"One" action:@selector(DoThingOne:)];
UIMenuItem* item2 = [[UIMenuItem alloc] initWithTitle:@"Two" action:@selector(DoThingTwo:)];
[UIMenuController sharedMenuController].menuItems = [[[NSArray alloc] initWithObjects:item1, item2, nil] autorelease];
[item1 release];
[item2 release];

但是,这仅在iPhone OS 3.2中使用,这使得它只能在此时使用iPad.有一个示例此处(滚动向下到自定义编辑菜单项").

However, this is only in iPhone OS 3.2, which would make it iPad only at this point. There's an example here (scroll down to "Custom Edit Menu Items").

关于更改现有项目,我认为目前尚不可能.

As for altering the existing items, I do not believe that is possible currently.

这篇关于长按是否覆盖iPhone复制菜单标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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