uimenucontroller

how to create Custom UIMenuController with only custom items other than default?

本小妞迷上赌 提交于 2019-12-06 06:13:44
问题 I have requirement to show menu items on uiwebview whenever user selects any text. I have tried let highlightMenuItem = UIMenuItem(title: "Highlight", action: #selector(ViewController.hightlight)) UIMenuController.sharedMenuController().menuItems = [highlightMenuItem] but this only appends more menu item with default existing one. as this Is there any way out to achieve this with only menu items Copy, Highlight and Note? 回答1: You can achieve this by subclassing UIWebView and overriding

show UIMenuController in UITableViewCell, grouped style

坚强是说给别人听的谎言 提交于 2019-12-05 23:58:17
Is there a simple way to implement the copy menu when a cell is tapped, instead of subclassing the UITableViewCell? thanks, RL Yes! Call [[UIMenuController sharedMenuController] setMenuVisible:YES animated:ani] (where ani is a BOOL determining whether the controller should be animated) from within - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath ( UITableView's delegate method) Edit: The 'copy' command on the UIMenuController will not by default copy the detailTextLabel.text text. However, there is a workaround. Add the following code into your class.

Hide Copy and Deselect UITextView options after copying all text

风格不统一 提交于 2019-12-05 19:58:22
I am working on a messaging app. I want to give a "copy" option to the user when they enter their message in a UITextView . When the user presses the "copy" button, it is copying the message, but the popover shows again and again, and the text is still selectable. I don't know how to control this. I have pasted some source code for your reference. I wrote a sub class for UITextView . - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { NSLog(@"Action : %@", NSStringFromSelector(action)); NSLog(@"Sender : %@", sender); if (action == @selector(copy:)) { [self selectAll:self]; //return

UITEXTVIEW: Get the recent word typed in uitextview

人走茶凉 提交于 2019-12-05 13:34:21
I want to get the most recent word entered by the user from the UITextView. The user can enter a word anywhere in the UITextView, in the middle or in the end or in the beginning. I would consider it a word when the user finishes typing it and presses a space and does any corrections using the "Suggestions from the UIMenuController ". Example: User types in "kimd" in the UITextView somewhere in the middle of text, he gets a popup for autocorrection "kind" which he does. After he does that, I want to capture "kind" and use it in my application. I searched a lot on the internet but found

uimenucontroller in uiwebview with custom menu items without MORE menu

安稳与你 提交于 2019-12-05 02:27:57
问题 In my iPad app, there is a UIWebview that displays text content. When I tap hold and select a text, a menu should popup with 2 custom menu. say, | MENU1 | MENU2 | But it seems the COPY menu will also accompany, which I couldn't disable. Is there any possibilities to disable it? I tried around the forum and no solutions worked out. so itz okay to keep the COPY menu along with the other 2. which should now look like | Copy | MENU1 | MENU2 | But unfortunately, I 'm getting it displayed with a

Text color in UIMenuController affected by UIButton appearance setting

拜拜、爱过 提交于 2019-12-05 02:24:46
I've observed following: By setting the Titlecolor of a UIButton with appearance, the UIMenuItems in a UIMenuController of a UITextView are getting the same color. Code in applicationDidFinishLaunching : [[UIButton appearance] setTitleColor:[UIColor greenColor] forState:UIControlStateNormal]; My question: Is there a way to suppress it or give a UIMenuItems another color? What i have tried: With appearanceWhenContainedIn UITextview I've tried to set the appearance for buttons contained in TextViews with [UIButton appearanceWhenContainedIn:[UITextView class], nil] But this obviously didn't work

_UIFallbackPresentationViewController

谁都会走 提交于 2019-12-04 22:02:20
问题 I keep getting the following error when I dismiss the dictionary that opens from tapping Define on the UIMenuController in a UIWebView on the iPhone:- Unbalanced calls to begin/end appearance transitions for <_UIFallbackPresentationViewController: 0x10ab9640>. And after this error, the UIMenuController stops showing up, in any UIWebView. Any ideas what's going on here? UPDATE: The error actually shows up when the dictionary view is opening, not when dismissing it. UPDATE 2: The error is app

Adding a dynamic custom UIMenuItem to Copy & Paste Menu before it shows

拟墨画扇 提交于 2019-12-04 13:46:21
问题 I have successfully been able to add a custom UIMenuItem to the Copy & Paste menu in my iPhone app, and even subclassed UITextView to get rid of the standard menu items. However, what I need to do is to somehow capture the fact that the menu is going to be displayed before it actually happens, and add the word at the insertion point into the menu. For example, if the text in the UITextView is "This is a test." , and the person touched the word "is" , it would add that word as a UIMenuItem to

How to remove Copy,Select All,Define menuItem from UIMenuController

早过忘川 提交于 2019-12-04 12:57:02
As my this question Display i want to display pop up when user select the text. and in that pop up detail about that word will be displayed. But i didn't get any satisfactory answer so i have change my logic. Now i want to display one item like Pop-Up in my UIMenuController and when user click that option than pop-up will displayed. I have achieved this using this code, UIMenuItem *menuItem = [[UIMenuItem alloc] initWithTitle:@"Pop-Up" action:@selector(displayPopUp:)]; [[UIMenuController sharedMenuController] setMenuItems:[NSArray arrayWithObject:menuItem]]; So my option is displaying and when

Showing UIMenuController loses keyboard

泪湿孤枕 提交于 2019-12-04 11:35:20
问题 I'm making an iphone app similar to the Messages app that comes on the phone. I just set up the ability to copy messages via a UIMenuController, but if the keyboard is showing and someone tries to copy a message, the keyboard goes away (presumably because of my [cell becomeFirstResponder]; where cell is the message cell being copied). Is there a way to show the Copy message without losing the keyboard? - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath