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
Post a Comment