title: Updating A Dynamically Created NSMenu with NSMenuItems
body: <p>I have a NSMenu with 3 static NSMenuItems that I want to keep, and a bunch after that are dynamically generated and should be removed and reloaded each time the user clicks the menu icon.</p>
  
  <p>I'm trying to create a list of processes that pop out, but each time I open the popout, the NSMenuItems don't clear. They just add on in some funky way. Logging the for loop shows that the loop isn't completing. Any ideas why?</p>
  
  <pre><code>-(void)menuNeedsUpdate:(NSMenu *)menu{
  
      //Keep Top 3 Menu Items
      if(dropDown.numberOfItems &gt; 3){
          NSLog(@"-----------Removing Items");
          NSLog(@"%d",itemCount);
          for(int i = 2; i &lt;= dropDown.numberOfItems; i++){
              NSLog(@"%d",i);
              [dropDown removeItemAtIndex:i];
  
          }
      }
  
      NSArray *appArray = [[NSWorkspace sharedWorkspace] runningApplications];
  
  
      for (NSRunningApplication *r in appArray){
          //NSLog(r.localizedName);
          //NSLog(@"------------");
          NSMenuItem *i = [[NSMenuItem alloc] initWithTitle:r.localizedName 
                                                 action:@selector(fooClicked:) keyEquivalent:@""];
          [i setTarget:self];
          [dropDown addItem:i];
  
          [i release];
      }
  
  
  }
  </code></pre>