我想将 UIPickerView 显示为按钮操作,并且选择器的选定行的文本将更新为文本字段的文本,以便用户可以使用选择器的选定值在文本字段中手动输入额外的文本. 所以,我这样做了:
- (IBAction)commandButton:(id)sender {
commandPicker = [[UIPickerView alloc]init];
commandPicker.delegate = self;
commandPicker.dataSource = self;
[commandPicker sizeToFit];
commandPicker.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
commandPicker.showsSelectionIndicator = YES;
[self.view addSubview:commandPicker];
}
但它不起作用。以及如何将文本字段的文本设置为选择器的选定值?