简体   繁体   中英

Add a new event in textView pop-up

I am using in my app a selectable UITextView . You know the pop-up for copy from UITextView .

在此处输入图片说明

I want to know if it's possible to add a new Event/Action in this pop-up and how can i do this?

Thank you in advance!

使用UIMenuController单例并向其中添加新的UIMenuItem

U can use below Code

UIMenuItem *testMenuItem = [[UIMenuItem alloc] initWithTitle:@"Info" action:@selector(handleInfo:)];
[[UIMenuController sharedMenuController] setMenuItems: @[testMenuItem]];
[[UIMenuController sharedMenuController] setTargetRect:CGRectMake(310, 25, 50, 50) inView:self];
[[UIMenuController sharedMenuController] update];

Also Refer below links

http://iphonedev.tv/blog/2014/4/17/show-the-uimenucontroller-and-display-custom-edit-menus-for-uiviewcontroller-uitableviewcontroller-and-uicollectionview-on-ios-7

http://nshipster.com/uimenucontroller/

Hope it helps you...!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM