title: How to update NSMenu while it's open?
body: <p>I have a NSMenu with dynamically added NSMenuItems. The NSMenu is not refreshing properly while it's kept open. I am calling NSMenu update method in <code>NSEventTrackingRunLoopModes</code>.</p>
  
  <p>I have implemented following methods to update NSMenu.</p>
  
  <pre><code>- (void)menuNeedsUpdate:(NSMenu *)menu {
  for (NSInteger index = 0; index &lt; count; index++)
      [self menu:menu updateItem:[menu itemAtIndex:index] 
                         atIndex:index 
                    shouldCancel:NO];
  }
  
  - (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel`
  
  - (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
  </code></pre>