我有一个NSComboBox,我试图让它成为当用户选择一个名字时,其他信息(费率,费率类型和国籍)会自动输入。它有时会起作用,但在其他时候会导致错误。
此代码:
public class Output
{
string aProperty;
int Count;
public override string ToString()
{
return string.Format("{0}: {1}", aProperty, Count);//Or whatever you want
}
}
导致此错误:
- (void)controlTextDidEndEditing:(NSNotification *)aNotification{
NSInteger index = [_nameBox indexOfItemWithObjectValue:[_nameBox stringValue]];
_lblRate.stringValue =[[contents objectAtIndex:index] objectForKey:@"Rate"];
NSInteger rateType =[[[contents objectAtIndex:index] objectForKey:@"RateType"] integerValue];
[_rateTypeSwitcher setSelected:YES forSegment:rateType];
[_nationalityMenu selectItemWithTitle:[[contents objectAtIndex:index] objectForKey:@"Nationality"]];
}