0
我有一個3組件ui選擇器索引,日期和時間的諮詢。如何閱讀uipicker多個組件時更改一個組件
我想在第一個組件被改變時讀取第二和第三個組件的值。
當組件1被更改時,應該如何閱讀UIPicker中的第二和第三組件?
[email protected][@"Sunday",@"Monday",@"Tuesday",@"Wednesday",@"Thursday",@"Friday",@"Saturday"];
[email protected][@"1",@"2",@"3",@"4",@"5",@"6",@"7"];
[email protected][@"9:00 AM",@"11:00 AM"];
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
if(component == 0){
_labelValueIndex.text = [self.indexes objectAtIndex:row];
// When component 1 is spinned read component 2 and component 3 value even if they are not spinned
[days objectAtIndex:row];// incorrect value as row variable is like global if i select indexes[1] . i also get days[1] and timeOfConsultation [1]
// How to read component 2 and component 3 value from component1 change event
}else if (component == 1){
labelValueBookingDay.text = [days objectAtIndex:row];
}
else{
labelValueTimeOfConsultation.text = [timeOfConsultation objectAtIndex:row];
}
}