uimenucontroller

WKWebView and UIMenuController

隐身守侯 提交于 2019-12-18 04:14:30
问题 I have an app with a WKWebView in it. In this app, I customize the options presented in the UIMenuController . The web view seems to add Copy and Define options to the menu no matter what I do. If I set myself as first responder and return NO for everything, I still get copy and define options. And I've implemented my own copy option that does special things depending on user preferences and what exactly is selected. Is there a way to remove these extra options? Update : I've filed this as

showing custom menu on selection in UIWebView in iphone

五迷三道 提交于 2019-12-17 17:26:58
问题 I want to show 2 options like "hi" & "bye" when user completes selection on UIWebView. I have added observer to my view controller as follows. But I don't know further implementation. [[UIMenuController sharedMenuController] addObserver:self forKeyPath:UIMenuControllerWillShowMenuNotification options:nil context:nil ]; 回答1: Sagar, Your question is a couple of months old, but I finally figured this one out, so I figured I'd answer it in case it helps out someone else. I added the following

Hide UIMenuController in UITextView

戏子无情 提交于 2019-12-13 18:35:20
问题 Subclassed UITextView Here is h file @interface CTextView : UITextView { } @end Here is m file code #import "CTextView.h" @implementation CTextView - (BOOL)canBecameFirstResponder { return NO; } @end Here is first UIViewController file in which subclassed UITextview is using #import "First.h" #import "CTextView.h" textView = [[[CTextView alloc] initWithFrame:CGRectMake(0, 0, 320, 410)]autorelease]; [self.view addSubview:textView]; But still not able to prevent copy select all from UITextView.

Showing UIMenuController deselects UITableViewCell

倾然丶 夕夏残阳落幕 提交于 2019-12-12 18:07:21
问题 I've implemented a long press gesture recognizer on a table view cell that shows the UIMenuController . But when menu shows, the corresponding table view cell deselects. Before showing the menu, I call, as required, [self becomeFirstResponder] . I think that this call deselects the cell, but how to make it to stay selected while the UIMenuController is visible? 回答1: A simpler way of implementing this is using the specific UITableViewDelegate methods for dealing with UIMenuController. But

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 = [[

How to disable copy,paste options in UITextView and enable it again iPhone app?

痴心易碎 提交于 2019-12-11 16:29:57
问题 Am working in UITextView based iPhone app. In one of my screen i having 3 UITextView when the user tap on the screen am showing UIMenuController with custom MenuItems. In this scenario UITextView is in Active means UITextView is becomResponder. So when i show UIMenuItem taping the screen UITextView UIMenuController showing with "Paste" option. I want to disable UIMenuController item from UITextView when the user touches the screen. Could you please anyone tell me how to disable UITextView

Setting UIMenuController arrow direction not working

柔情痞子 提交于 2019-12-11 10:09:40
问题 I have a UIMenuController which I have added a few extra items to. I would like the menu to be BELOW the text that I select, so I tried: [UIMenuController sharedMenuController].arrowDirection = UIMenuControllerArrowDown; That seemed to do nothing, and everything I try, won't put the menu below the text. How can I do that? 回答1: According to the docs, arrowDirection sets the direction the arrow points; it has nothing to do with the location of the menu relative to its target area. It also looks

Updating UIMenuController on the fly

人盡茶涼 提交于 2019-12-11 08:08:53
问题 My application has the ability to pop up a menu. When the "Select All" button is pressed, I want to enable the "Delete" button. However I haven't been able to get this working. Here is a sample project illustrating the issue. Run it, then tap the Menu button, press Select All. The Delete button should appear immediately, but it only appears when you hide the menu and then show it again. How can I fix this? 回答1: The following does the trick: - (void)didHide:(NSNotification *)notif {

UILabel - Long press gesture for menu item of UIMenuController

我们两清 提交于 2019-12-11 07:32:20
问题 I need to handle long press action/gesture on UILable, in an entire app, and it should show a menu like this, with custom menu options: As per apple interface guideline a text field, a text view, a web view, and an image view can only enable this menu. Is it feasible to add such action in UILabel for the entire app and open custom menu by adding own menu options, with existing? 回答1: Here is a UILabel subclass that handles long pressing to show the UIMenuController . You can also add more

UIMenuController On UITableView Does Not Show Up In Spite Of All Methods

对着背影说爱祢 提交于 2019-12-11 06:55:51
问题 I have UITableView to display some list. Implemented UILongPressGestureRecognizer to get calls and on this I want to display menu for delete, upload, etc actions. Following is implementation // Registering for long press event UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; lpgr.delegate = self; [self.myTable addGestureRecognizer:lpgr]; On Long Press My control comes to function - (IBAction)handleLongPress: