Note that there are some explanatory texts on larger screens.

plurals
  1. POios UIMenuController doesn't work with balloon view
    text
    copied!<p>I have a ballon view and when I tap on cell UIMenuController doesn't appear. I tried to implement in </p> <blockquote> <ul> <li>(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath,</li> </ul> </blockquote> <p>then I added a long press gesture </p> <blockquote> <ul> <li>(void)longPress:(UILongPressGestureRecognizer *)recognizer,</li> </ul> </blockquote> <p>in the end I added an implementation in extended </p> <blockquote> <p>UITableViewCell</p> </blockquote> <p>class, but it still doesn't work.</p> <p>Here is an example </p> <pre><code>- (BOOL)canBecomeFirstResponder { return YES; } - (BOOL) canPerformAction:(SEL)selector withSender:(id) sender { return YES; } -(void)copyAction:(id)sender{ NSLog(@"copy"); } -(void)deleteAction:(id)sender{ NSLog(@"delete"); } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. BalloonCell *cell = (BalloonCell*)[tableView cellForRowAtIndexPath:indexPath]; [self becomeFirstResponder]; BOOL isCanBecomde = [self canBecomeFirstResponder]; BOOL isFirst = [self isFirstResponder]; UIMenuItem *copy = [[UIMenuItem alloc] initWithTitle:@"Копировать" action:@selector(copyAction:)]; UIMenuItem *delete = [[UIMenuItem alloc] initWithTitle:@"Удалить" action:@selector(deleteAction:)]; UIMenuController *menu = [UIMenuController sharedMenuController]; CGRect drawRect = [cell convertRect:cell.bounds toView:self.view]; [menu setTargetRect:drawRect inView:window]; [menu setMenuItems:[NSArray arrayWithObjects:copy, delete, nil]]; [menu setMenuVisible:YES animated:YES]; } </code></pre> <p>Do you have any guess why UIMenuController doesn't appear?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload