您的当前位置:首页正文

MacOS NSComBox 使用

来源:华拓网

1、需要 选择“uses data source”,不然datasource是不启作用



2、代理

// Combo box data source methods

// ==========================================================

- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox {

return 2;

}

- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)loc {

return [NSString stringWithFormat:@"%ld",loc];

}