) 在 NSPopupButton 我必须存储不同的项目。这些通常会根据其他操作而改变:
NSArray* array = [NSArray arrayWithArray:mynewobject];
// Obviously I do not know which items will be found by mynewobject
//[_myPopupButton removeAllItems]; // ...But I want to mantain itemAtIndex:0!!
// ..and then:
for (NSDictionary *dict in array)
{
[_myPopupButton addItemWithTitle:[[dict objectForKey:miciomicio] lastPathComponent]];
}
我的意图是删除旧项目,然后添加新项目。在将项目保持在索引 0 的同时可以做到这一点吗?......会很好!