简体   繁体   中英

UIMenuController strange behavior between UITableViewCell and UITextView

In my app after long press on a cell the UIMenuController pop that I configured according to my need, selecting any option like copy also working fine but after that when I tap or long press on my UITextView the UIMenuController still pop over the cell not on my UITextView but perform action on UITextView . Why? Please see the screenshot.

一种

You have to set the target rect for the uitextfield and set the superview for the frame as given code, try this

UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuItems:[NSArray arrayWithObjects:@"Paste", nil]];
[menu setTargetRect:textfield.frame inView:self.view];
[menu setMenuVisible:YES animated:YES]; 

Might be helpful for 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