我有一个 uipickerview,您可以选择已设置为数组的项目,但我正在努力研究如何将 uilabel 的文本设置为所选选项。
这是我用来创建 uipicker 委托和数据源的代码:
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return [treatments count];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 1;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return[[treatments objectAtIndex:row]valueForKey:@"treatmentName"];
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
}
我所知道的是它必须在 uipicker didselectrow 函数中完成
提前致谢