uimenuitem

UIMenuController in iOS 13 beta shows with transparent background instead of black background

我与影子孤独终老i 提交于 2020-07-22 06:29:04
问题 I am using UIMenuController to display custom options. It was working fine with a black background and white text on UIMenuItems till iOS 12. After upgrading to iOS 13 beta 8 with Xcode 11 beta 7, the background changed to transparent. Is there anyone else facing this problem? 来源: https://stackoverflow.com/questions/57699513/uimenucontroller-in-ios-13-beta-shows-with-transparent-background-instead-of-bla

How to disable Copy & Define UIMenuItems of UIMenuController in UITextfield

痞子三分冷 提交于 2020-01-01 19:14:23
问题 I am implementing custom UIMenuController and trying to figure out. How can I legally disable "Copy" and "Define" UIMenuItems of UIMenuController in UITextfield ? Textfield is not editable. I tried to disable "Copy" using: -(BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (action == @selector(copy:)) { return NO; } return [super canPerformAction:action withSender:sender]; } - (IBAction)tapTextViewGesture:(id)sender { UIMenuItem *myItem1 = [[UIMenuItem alloc] initWithTitle:@

UIMenuItem #selector method crash in wkwebview

笑着哭i 提交于 2019-12-23 15:24:07
问题 UIMenuItem selector method crashes in iOS 11 beta SDK. -[WKContentView highlightText]: unrecognized selector sent to instance 0x7f85df8f3200 Method Definition: func highlightText() { // } I try to add UIMenuItem in WKWebView, let menuItemHighlight = UIMenuItem.init(title: "Highlight", action: #selector(ContentWebkitView.highlightText)) UIMenuController.shared.menuItems = [menuItemHighlight] 回答1: I was also getting this error when I was overriding canPerformAction and checking for my custom

Remove copy and define from UIMenuController

蹲街弑〆低调 提交于 2019-12-11 19:59:34
问题 I have UIWebView for displaying some articles. I need to select some text from UIWebView and use bookmark. So i'm using selection = [wbCont stringByEvaluatingJavaScriptFromString:@"window.getSelection().toString()"]; But when i longpress the UIMenuItem displays with copy,define. I read some doc and used canPerformAction: copy NO. But still it displaying. - (void)viewDidLoad { [wbCont loadHTMLString:webString baseURL:nil]; [self.view addSubview:wbCont]; NSMutableArray *items = [[

Load a remote image in a MenuItem using Glide

白昼怎懂夜的黑 提交于 2019-12-10 21:33:53
问题 Usually if I want to load an image with Glide I would write the following: Glide.with(context) .load(theURLOftheImage) .error(R.drawable.ic_error_image) .into(theImageView); but what if I need to load the image of that URL into a MenuItem that has to be changed in real time? The following is not possible because the method into does not accept the parameter: @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem settingsItem = menu.findItem(R.id.actionbar_menu_profile_actions);

Order of UIMenuItems in custom edit menu

烂漫一生 提交于 2019-12-08 12:05:39
问题 I want to add my own commands to the selection menu, but also keep the standard "copy", "cut", etc. commands. I use this: UIMenuItem *myItem = [[UIMenuItem alloc] initWithTitle:@"My Command" action:@selector(myCommand:)]; [[UIMenuController sharedMenuController] setMenuItems:[NSArray arrayWithObjects: myItem, nil]]; But this adds my command to the very end of the list in the edit menu. I want my command to appear first in it. How could I achieve this? 回答1: Solved it by myself. Here is what in

UIMenuController not getting displayed

我与影子孤独终老i 提交于 2019-12-06 06:48:17
问题 I am displaying UIMenuController on long press & double tap gesture, but its not getting displayed. I have followed the answers given here but it still not showing up. UIMenuController not showing up Below is my code - (void) doubleTap:(UITapGestureRecognizer *)gesture { [self becomeFirstResponder]; CGPoint location = [gesture locationInView:[gesture view]]; UIMenuController *menuController = [UIMenuController sharedMenuController]; UIMenuItem *resetMenuItem = [[UIMenuItem alloc]

UIMenuController not getting displayed

大憨熊 提交于 2019-12-04 11:19:56
I am displaying UIMenuController on long press & double tap gesture, but its not getting displayed. I have followed the answers given here but it still not showing up. UIMenuController not showing up Below is my code - (void) doubleTap:(UITapGestureRecognizer *)gesture { [self becomeFirstResponder]; CGPoint location = [gesture locationInView:[gesture view]]; UIMenuController *menuController = [UIMenuController sharedMenuController]; UIMenuItem *resetMenuItem = [[UIMenuItem alloc] initWithTitle:@"DoubleTap" action:@selector(hideKeyboard)]; [menuController setMenuItems:[NSArray arrayWithObject