Selecting a row in a UIPickerView dynamically?

Hook the button to an action method, then in your action method simply call the same selectRow:inComponent:animated: method, i. E (IBAction)button1Action { picker selectRow:20 inComponent:0 animated:YES; } And you hook up the button to that method in Interface Builder.

Hook the button to an action method, then in your action method simply call the same selectRow:inComponent:animated: method, i.e. - (IBAction)button1Action { picker selectRow:20 inComponent:0 animated:YES; } And you hook up the button to that method in Interface Builder.

Yes, I did that. I even call 'reloadComponent' from the picker but it still does not work. I must be missing something here.

This is the code I use for 'button1' in my app. - (IBAction) goToRowTwenty { picker selectRow:20 inComponent:0 animated:YES; timerPickerView reloadComponent:0; } – Tuyen Nguyen Sep 10 '10 at 14:19.

You can put the same code that you have kept in viewDidLoad for selecting pickerRow on the event that get fires when button is clicked. -(void)button1clickevent{ //FUNCTION MUST GET FIRE WHEN BUttON! IS CLICKED picker selectRow:50 inComponent:0 animated:YES; } HAPPY iCODING...

Yes, I did that. I even call 'reloadComponent' from the picker but it still does not work. I must be missing something here.

This is the code I use for 'button1' in my app. - (IBAction) goToRowTwenty { picker selectRow:20 inComponent:0 animated:YES; timerPickerView reloadComponent:0; } – Tuyen Nguyen Sep 10 '10 at 14:20 and whats this timepickerView here... reload your picker picker reloadComponent:0 not timepicker reloadComponent:0; Also theres no need to reload picker. Please check out whether your picker is really binded with the picker in xib.

– crazyCoder Sep 13 '10 at 5:21.

Also make sure that picker is defined with "IBOutlet" as follows. And connect the picker's referencing outlet to this: @property (nonatomic, retain) IBOutlet UIPickerView *picker.

OK, now I recreate the project and retype the code: - (IBAction) goToRowTwenty { picker selectRow:20 inComponent:0 animated:YES; timerPickerView reloadComponent:0; } and it works, I really don't know what happened, but thank you guys for answering my question.

I have an iPhone app that use UIPickerView and 3 buttons. This picker has one component with 100 rows (0, 1, 2, ..., 98, 99). But I could not make the picker select the desired row when I tap the buttons.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions