2013-01-16 35 views
0

我想實現一個自定義的下拉菜單,它將允許用戶快速更改iOS應用程序中的視圖。我決定爲此使用UIPickerView。但我沒有找到任何關於如何通過UIPickerView更改視圖的教程,所以我需要一些關於此和建議的幫助。代碼示例將非常有幫助。如何通過iOS應用程序中的UIPickerView實現視圖之間的轉換?

+0

@rdelmar我試着按照這個教程http://iosmadesimple.blogspot.com/2012/09/uipickerview-tutorial.html使用UINavigationController。但它不起作用 - 我有一個例外。 – MainstreamDeveloper00

+1

顯示您嘗試的代碼,以及您得到的例外。 – rdelmar

回答

4

以下方法是用於行選擇的UIPickerview委託方法。

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent: 
(NSInteger)component  
{ 
    //in this method hide the views that you don't want to show and show the views that you 
    //don't want to hide, when a particular row is selected. 

    NSLog(@"row selected----->>%d",row); 
} 
相關問題