我是IOS的新手我希望以编程方式显示两个带有单个选择器视图的文本字段。我为两个不同的文本字段创建了两个数组但是在运行我的选择器视图时只显示第一个数组并选择了pickerview两个textfield changing.where我做错了?
选择器视图编码中的完成按钮操作:
-(void)pickerDoneClicked
{
NSLog(@"Done Clicked");
[txtText resignFirstResponder];
[currency1 resignFirstResponder];
}
选择器视图委托:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return arrMsg.count;
return currencyname1.count;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return [arrMsg objectAtIndex:row];
return [currencyname1 objectAtIndex:row];
}
- (void) pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
txtText.text = (NSString *)[arrMsg objectAtIndex:row];
currency1.text = (NSString *)[currencyname1 objectAtIndex:row];
}