我有一個兩難的問題,我有兩個UIPickerViews「顯示」兩個不同的視圖加載時。我從一個UIPickerView
開始,並能夠通過在ViewController中加載數組和所有其他UIPickerView
操作來啓動並運行。多個UIPickerViews
我認爲這將會像爲新的UIPickerView
複製/粘貼相同的方法一樣簡單,只是更改變量名稱,也在同一個UIViewController
內。
問題是 - 兩個UIPickerView
在下拉列表中顯示相同的數據集?我在這裏只是錯過了一些明顯的東西?
更新下面
我做了所有四種方法下面和現在的應用程序崩潰,一旦「下一步」視圖被加載?這看起來正確嗎?
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView
- (NSInteger)thePickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component
- (NSString *)thePickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
- (void)thePickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
是的方法看起來不錯,你的崩潰是由於別的東西。嘗試調試器!在運行 - >調試器。或發佈更多的代碼。 – ThomasRS 2011-04-05 01:36:02