uimenucontroller

How could I replace UIMenuController with my own view when text is selected?

元气小坏坏 提交于 2019-12-03 01:12:26
问题 When text is selected, by default a UIMenuController pops up with cut/copy/paste etc. I'd like to replace this with my own custom view (similar looking, but twice as high so that I can have two rows of buttons/custom views). How can I do this? I know there's no easy way. I'm expecting that if there's an easy solution, it won't be very elegant. The code can't use any private API either. I'd really, really rather not have to implement my own text view, reimplement text selection and input, and

How could I replace UIMenuController with my own view when text is selected?

喜夏-厌秋 提交于 2019-12-02 14:31:40
When text is selected, by default a UIMenuController pops up with cut/copy/paste etc. I'd like to replace this with my own custom view (similar looking, but twice as high so that I can have two rows of buttons/custom views). How can I do this? I know there's no easy way. I'm expecting that if there's an easy solution, it won't be very elegant. The code can't use any private API either. I'd really, really rather not have to implement my own text view, reimplement text selection and input, and reimplement the magnifying view just so I can write my own UIMenuController clone if there's any way to

Can UIMenuItem show UIImage?

孤者浪人 提交于 2019-12-02 11:40:23
问题 I saw that it's possible — iBooks application does it. Is it any way to do it? 回答1: I wrote a category to support image for UIMenuItem. It's based on method swizzling, but should be safe in most cases. https://github.com/cxa/UIMenuItem-CXAImageSupport 回答2: There is nothing in the current official API do that. UIMenuItem can only be initialised with -initWithTitle:action: I suspect that Apple either using a private API or have implemented a custom control. Probably the former. Asked previously

iPhone6 (no display zoom mode) UIMenuController truncated

大兔子大兔子 提交于 2019-12-01 20:49:37
I have a problem with the UIMenuController on my iPhone 6 when I use the standard display mode and device is in landscape mode. On iPhone 6 Plus the problem is in both modes. Maybe it's depends on screen resolution. In that case, the UIMenuController will be truncated left and/or right. It seems that the UIMenuController can have maximum bounds as if the phone is in portrait mode. See UIMenuController truncated (iPhone6 landscape schematic): http://imageshack.com/a/img631/8470/ozlaGe.jpg "iPhone6 landscape" For me it seems like an iOS8+iPhone 6 bug. The code didn't change for a long time and

UIMenuController: how to tell which menuItem is pressed?

这一生的挚爱 提交于 2019-12-01 11:49:33
问题 I have a UILongPressGestureRecognizer on a UITableViewCell that displays a UIMenuController with some categories the user can pick from. These categories are stored in a NSMutableArray and can be customized by the user. I want to use one method to handle all category-presses in the UIMenuController. How can I pass the index of the selected UIMenuItem? Thanks in advance. #pragma mark - #pragma mark Custom Quick Menu Item @interface QuickMenuItem : UIMenuItem { } @property (nonatomic, retain)

UIMenuController with custom item not working with UICollectionview

亡梦爱人 提交于 2019-12-01 02:33:08
问题 I have added custom menu controller when long press on UICollectionViewCell [self becomeFirstResponder]; UIMenuItem *menuItem = [[UIMenuItem alloc] initWithTitle:@"Custom Action" action:@selector(customAction:)]; [[UIMenuController sharedMenuController] setMenuItems:[NSArray arrayWithObject:menuItem]]; [[UIMenuController sharedMenuController] setTargetRect: self.frame inView:self.superview]; [[UIMenuController sharedMenuController] setMenuVisible:YES animated: YES]; canBecomeFirstResponder Is

Disable entire UIMenuController edit menu in WKWebView

♀尐吖头ヾ 提交于 2019-11-30 13:43:58
问题 Requirement I have a WKWebView and would like to remove the system menu items (Copy, Define, Share...) from the Edit Menu and present my own. I am targeting iOS 8 and 9. I am currently testing with the Xcode 7.0.1 simulator (iOS 9) and my iPhone 6 running iOS 9.0.2. Standard Method Does Not Work I know the standard way of achieving this is by subclassing WKWebView and implementing -canPerformAction:withSender: . However, I have found that with WKWebView -canPerformAction:withSender: is not

Disable entire UIMenuController edit menu in WKWebView

回眸只為那壹抹淺笑 提交于 2019-11-30 08:15:12
Requirement I have a WKWebView and would like to remove the system menu items (Copy, Define, Share...) from the Edit Menu and present my own. I am targeting iOS 8 and 9. I am currently testing with the Xcode 7.0.1 simulator (iOS 9) and my iPhone 6 running iOS 9.0.2. Standard Method Does Not Work I know the standard way of achieving this is by subclassing WKWebView and implementing -canPerformAction:withSender: . However, I have found that with WKWebView -canPerformAction:withSender: is not being called for the copy: or define: actions. This appears to be a known bug ( WKWebView and

Implementing iphone's copy/paste controls on a custom view / uiview subclass

本小妞迷上赌 提交于 2019-11-30 05:20:35
I will admit that there is already a question exactly along these lines here on S.O., but it lacks implementation details, a working answer, and I would like to be more specific, so I think a new question is in order. Obviously, let me know if I'm wrong and we can try to restart the thread over there . Basically, I want to copy the text in a UILabel to the pasteboard when a user holds down on the label. Not hard to do, honestly. However, I think the best way to provide visual feedback is to prompt the user with the Copy menu option from UIMenuController . According to the Event Handling

Perform copy/cut from UIResponderStandardEditActions

你离开我真会死。 提交于 2019-11-29 12:38:20
These are standart actions for UIMenuController declared http://developer.apple.com/library/ios/#documentation/uikit/reference/UIResponderStandardEditActions_Protocol/UIResponderStandardEditActions.html How can I perform these methods manually, like from another UIMenuItem or whatever? I can't find the right selector:( [self cut:sender]; [UIResponder cut:sender]; [[UIMenuController sharedMenuController] cut:sender]; (void) cut: (id) sender {[super cut:sender];} So far non of these don't work, selector not found. You need to send the action along the responder chain, starting with the "first