title: iOS: Pop-up menu does not behave in accordance with first responder set
body: <p>I have several objects inheriting <code>UIView</code> in my application that are tracking taps on them and presenting Copy/Paste pop-up if they contain some specific data. When pop-up is presented I change the appearance of the object as well.</p>
  
  <p>This is how it is implemented:</p>
  
  <pre><code>- (void)viewDidReceiveSingleTap:(NSNotification *)n {
      MyObject *mo = (MyObject *)n.object;
  
      [mo becomeFirstResponder];
      UIMenuController *menu = [UIMenuController sharedMenuController];
      [menu update];
  
      [menu setTargetRect:CGRectMake(...) inView:mo];
  
      [menu setMenuVisible:YES animated:YES];
  }
  </code></pre>
  
  <p><code>MyObject</code> class, in turn, defines <code>canBecomeFirstResponder:</code> and <code>canResignFirstResponder:</code> as always returning <code>YES</code>. <code>becomeFirstResponder:</code>, <code>resignFirstResponder:</code>, and <code>canPerformAction:withSender:</code> is also defined accordingly (this is where I change the appearance of the object).</p>
  
  <p>This is what goes wrong:</p>
  
  <p>I tap object 1. The method <code>viewDidReceiveSingleTap:</code> above is getting called, and the object's <code>canBecomeFirstResponder:</code> and <code>becomeFirstResponder:</code> are getting called too. The pop-up menu is displayed as expected.</p>
  
  <p>I tap another object 2. <code>viewDidReceiveSingleTap:</code> is called again and here's where the trouble starts. First, <code>canResignFirstResponder:</code>, <code>resignFirstResponder:</code> of object 1 are called, but not always, and I can't figure out the pattern. <code>canBecomeFirstResponder:</code> and <code>becomeFirstResponder:</code> of object 2 are called properly, but the pop-up menu does not relocate. It just disappears (though in the <code>viewDidReceiveSingleTap:</code> I clearly call <code>setMenuVisible:YES</code>). In order to make it appear, I have to tap object 2 (or any other) again -- in this case I can see from the debugger that object 2 was set as a first responder, it's just the pop-up that wasn't appearing.</p>
  
  <p>What am I doing wrong? Any clues on relation between pop-up menu visibility and first responder?</p>