0
我使用UIPickerView
與UITextField
。當我僅使用一個UITextField
時它正在工作。 我想要的是對一個動態pickerview
使用多個TextField
。動態UIPickerView與多個TextField
- (void)viewDidLoad
{
[super viewDidLoad];
picker = [[UIPickerView alloc] init];
picker.dataSource = self;
picker.delegate = self;
self.transitTF.inputView = picker;
self.theData = @[@"one",@"two",@"three",@"four"];
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return self.theData.count;
}
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 1;
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return self.theData[row];
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
self.transitTF.text = self.theData[row];
[self.transitTF resignFirstResponder];
}
這就是我只用一個textField
。
任何幫助將不勝感激。謝謝。