Menu options not visible after tapping on one of the menu option

576 views Asked by At

I am not able to show other menus on tapping a particular menu option. The behavior which I want is similar to the default cut-copy menu options that is: When I long press in UITextView area, I get select,select all and other menus. If I tap on select all, immediately i see copy, paste options.

Similar in my app, I have an image on the screen. When I long press the image, I get delete menu. When i tap on delete I should get really delete, cancel menu options. I am not able to show really delete, cancel options. Is there any way to do this. I have come across update method of UIMenucontroller. But don't know how to use it.

1

There are 1 answers

3
Snehal On BEST ANSWER

Try this it works.

In your menu item click event, add notification for UIMenuHideNotification and in its handler write follwoing code

- (void)didHide:(NSNotification *)notif {
    UIMenuController *mc = [UIMenuController sharedMenuController];
    dispatch_async(dispatch_get_global_queue(0,0), ^{
        dispatch_async(dispatch_get_main_queue(), ^{
            //create a new menu items add it to mc and display it///
            [mc setMenuVisible:YES animated:YES];
        });
    });
}