2011-07-18 24 views
0

我有兩列,在uipicker。當我從第一列中選​​擇一些內容時,我希望在另一列上更改選項。更新uipicker

源代碼任何人?

多謝

+0

退房這個計算器的答案 - http://stackoverflow.com/questions/5311552/dependent-uipickerview – Saurabh

回答

0

檢查出書Apress出版的「iPhone 4發展」,在第7章有由相關的選擇器,那你想(這就是所謂的依賴uipickerview)之一。

0

嘗試這樣的事情 -

- (void)pickerView:(UIPickerView *)pickerView 
     didSelectRow:(NSInteger)row 
     inComponent:(NSInteger)component { 
    if (component == 0) { 

     //Here First Part of the Pickerview is represented using 0. 
     // dependentPicker is the Pickerview outlet 

     [dependentPicker selectRow:row inComponent:1 animated:YES]; 
     [dependentPicker reloadComponent:1]; 
    } 
    else 
    { 
     [dependentPicker selectRow:row inComponent:0 animated:YES]; 
     [dependentPicker reloadComponent:1]; 
    } 
}