1

I’m trying to use the inAppBrowser Plugin with PhoneGap3.3 in XCode.

My purpose is to choose a word and any texts in the html page, highlight them and popup the menu.The default menu items are” COPY” and ”DEFINE”. I want to disable the default menu items and customize them as ”ITEM1”,”ITEM2” etc.

Now with someone's kindly help I've used the method("viewDidAppear") and added new menu items right after the default ones as "COPY,DEFINE,ITEM1,ITEM2",but can't delete or disable the old default item. Here is the code to add it:

-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSLog(@"inappbrowser appeared");
UIMenuItem *customMenuItem1 = [[UIMenuItem alloc] initWithTitle:@"Custom 1" action:@selector(customAction1)] ;
UIMenuItem *customMenuItem2 = [[UIMenuItem alloc] initWithTitle:@"Custom 2" action:@selector(customAction2)];
[[UIMenuController sharedMenuController] setMenuItems:[NSArray arrayWithObjects:customMenuItem1, customMenuItem2, nil]];
}

-(void)customAction1 {
NSLog(@"custom 1 selected");
}

-(void)customAction2 {
NSLog(@"custom 2 selected");
}

So what should I do? What method or function should I use to entirely customize the items?

Josie.c
  • 11
  • 3

0 Answers0