0
我累了選擇器視圖ie(貨幣),(id)和顯示的兩個組件,但我的問題是如何在選擇器視圖中單獨隱藏「id」組件。和responseArray1中的「id」。選擇器查看一個組件隱藏和其他組件隱藏
選擇器視圖代表:
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;{
return 2;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;{
return [responseArray count];
}
-(NSString*) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;{
//return [responseArray objectAtIndex:row];
if (component == 0) {
return [responseArray objectAtIndex:row];
} else {
return [responseArray1 objectAtIndex:row];
}
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
{
NSLog([responseArray1 objectAtIndex:row]);
if (component == 0) {
[pickerView selectRow:row inComponent:1 animated:YES ];
} else if(component == 1)
{
if (row != [pickerView selectedRowInComponent:0])
{
[pickerView selectRow:[pickerView selectedRowInComponent:0] inComponent:1 animated:YES];
}
}
}
那麼,你想要什麼?沒有正確地得到你的問題 – Lion
兩個組件在選取器視圖中一個組件想要隱藏並且其他組件想要取消隱藏@Lion –
當想隱藏並且想要取消隱藏時?如果一次只需要一個組件,那麼爲什麼你返回2? – Lion