nsarray - NSPopupButton remove all the items except one -


) in nspopupbutton have store different items. these can change depending on other actions:

  nsarray* array = [nsarray arraywitharray:mynewobject];   // not know items found mynewobject    //[_mypopupbutton removeallitems]; // ...but want mantain itematindex:0!!   // ..and then:    (nsdictionary *dict in array)   {       [_mypopupbutton additemwithtitle:[[dict objectforkey:miciomicio] lastpathcomponent]];    } 

my intention delete old items , add new ones. possible while maintaining item @ index 0? ...it nice!

nsmenuitem *firstitem  = [_mypopupbutton itematindex:0]; [_mypopupbutton removeallitems]; [[_mypopupbutton menu] additem:firstitem]; 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -