문제

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 need all those 2 items to be displayed in the first attempt itself. either just the 2 menus alone, or atleast along with the copy menu.

| Copy | MENU1 | MENU2 |

OR

| MENU1 | MENU2 |

Get me some solution please.... Trying it out in many ways.. But nothing is working out... Plz help me out...

Thanks, Brian

도움이 되었습니까?

해결책

It doesn't appear that there is a way to do this without replacing the UIMenuController. One option is to handle your own UILongPressGestureRecognizer (see How to remove th COPY UIMenuItem in UIMenuController). I've seen proposals where you override canPerformAction, but this does not work. Interestingly, the "copy:" action is never called, though it seems that everything else (cut:,select:,etc.) is.

- (BOOL) canPerformAction:(SEL)action withSender:(id)sender
{
    if (action == @selector(defineSelection:))
    {
        return YES;
    }
    else if (action == @selector(translateSelection:))
    {
        return YES; 
    }
    else if (action == @selector(copy:))
    {
        return NO;
    }

    return [super canPerformAction:action withSender:sender];
}

`

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top