我创建了4行的选择器视图,但所有行中的数据都相同。那么我如何分离每一行的数据并用它来计算?
答案 0 :(得分:0)
也许这可能适用于您不显示数据的问题?无法真正说出因为我看不到你已经做过的事情。
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
return 4;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent (NSInteger)component{
return rowOneItems.count;
return rowTwoItems.count;
return rowThreeItems.count;
return rowFourItems.count;
}
-(NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
if(component == 1)
return[rowTwoItems objectAtIndex:row];
else if(component == 2)
return[rowThreeItems objectAtIndex:row];
else if(component == 3)
return[rowFourItems objectAtIndex:row];
else
return [rowOneItems objectAtIndex:row];
}