2013-06-24 42 views
1

值是否有在-(void)viewDidLoad辦法讓我選擇器啓動在一定的價值。例如,如果我有一個選擇器顯示: 1,2,3,4,5 我可以在3上啓動它嗎?這有意義嗎?由於設置選擇器視圖對負載

+0

哪來關於Xcode的問題?我沒看到它。 – 2013-06-24 06:07:37

+0

代碼正在xcode中使用,這就是爲什麼我說Xcode。 –

+0

那麼,如果您使用另一個IDE,問題和解決方案將無所謂 - 它與Xcode無關。 – 2013-06-24 06:34:50

回答

2

你可以使用這個實例方法:

- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated; 

UIPickerView Documentation

你的情況,這將是這樣的:

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    [myPickerView selectRow:3 inComponent:0 animated:NO]; 
} 
+0

謝謝你的幫助! –