uimenucontroller

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

Disable copy, paste in UITextfield is not working in iOS 9.x

主宰稳场 提交于 2019-12-04 03:41:54
问题 I created a text field in one class BBCustomUtility.h,.m class files and then +(UITextField*)createTextField: (CGRect)rect image:(NSString*)imageName tag:(int)tag secureText:(BOOL)entry placeh:(NSString*)placeholder { UITextField *transactionField = [ [ UITextField alloc ] initWithFrame: rect ]; transactionField.background = [UIImage imageNamed:imageName]; transactionField.adjustsFontSizeToFitWidth = YES; transactionField.textColor = [UIColor blackColor]; transactionField.font = [UIFont

Removing default cut, copy, paste from UIMenuController in a TableView

夙愿已清 提交于 2019-12-04 01:24:31
问题 I'm trying to remove the default menu items from UIMenuController. I found this post for UIWebview or UITextView: How to remove the default UIMenuItem from the UIMenuController in iOS? I'm trying to do this for the new iOS 5 methods where you can show a menu item on the table selection. So my class is a subclass of UIViewController that has a UITableView in it. I wasn't sure how or IF removing the default items was possible. Thanks! 回答1: The table view delegate method -tableView

How to remove th COPY UIMenuItem in UIMenuController

邮差的信 提交于 2019-12-03 22:33:06
I am developing an iPhone application and worked with UIWebViews. I planned to customize the UIMenuItems thats popped up when i highlight strings in UiWebView (Copy, Select All, Cut, etc.). I tried removing those menuItems but i cannot remove the COPY menu item. I need your help guys. Thanks, ZaldzBugz You're going to have to do some hijacking. I don't even know if it is possible. It looks like it probably responds to a gesture event called UILongPressGestureRecognizer. You need to find out what view has the gesture added to it. something like this. NSArray *gestures = myWebView

uimenucontroller in uiwebview with custom menu items without MORE menu

回眸只為那壹抹淺笑 提交于 2019-12-03 17:20:43
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 MORE menu as follows : | Copy | More... | Clicking the More... menu is showing the other 2 menu. But I

_UIFallbackPresentationViewController

▼魔方 西西 提交于 2019-12-03 13:53:48
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 wide. Anywhere there is selectable text (i.e. webview, textview etc.) I can only use the define

Display UIMenuController in editingDidBegin of a UITextField

拥有回忆 提交于 2019-12-03 10:08:05
I simply want to display the UIMenuController right after a textfield has become active. What i'm doing right now is: - (IBAction)textFieldeditingDidBegin:(UITextField *)sender { // textfield menu item UIMenuController *menu = [UIMenuController sharedMenuController]; [menu setTargetRect:sender.frame inView:self.view]; [menu setMenuVisible:YES animated:YES]; } The method gets called but it just will not display the menu... If i do a touch+hold gesture on the textfield it comes up regularly. I hope there's a simple solution for that, Thanks I found a good solution to your question. You can

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

六月ゝ 毕业季﹏ 提交于 2019-12-03 08:37:17
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 the UIMenuController . It is important that the menu show the word only directly after it has been

Problems showing UIMenuController one after another

戏子无情 提交于 2019-12-03 07:08:38
I'm using the new customization abilities of the UIMenuController to add things other than "Copy" to the menu for cut&paste into a webview. What I do is getting the reference to the shared UIMenuController, setting my NSArray of UIMenuItems into the menuItems, and everything work fine as long as I add a single item. For instance I see [COPY|FOOBAR]. Instead if I try adding more than a single item, what happen is that I see [COPY|MORE], if I press into MORE than finally the other items will show up. Is possible to show directly [COPY|FOO|BAR|THREE|FOUR] instead? I saw a few applications that

Determine when a UIMenuController is dismissed?

孤人 提交于 2019-12-03 05:57:09
问题 Is there a way to determine when a UIMenuController has been dismissed? I have a (non-editable) text area I'm highlighting when the menu is brought up, and I'd like to un-highlight it when they either select an item (easy) or cancel (not possible?) 回答1: On state changes UIMenuController posts notifications to the default NSNotification center. You can subscribe to them to get notified when the system hides the menu: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector