I have 3 buttons on one View of UIViewController. On each button click event i called same picker view with different object values.
how to set the selection indicator on last object index for particular button.?
I have 3 buttons on one View of UIViewController. On each button click event i called same picker view with different object values.
how to set the selection indicator on last object index for particular button.?
In button click event you can make use of this.
selectRow:inComponent:animated:
- Helps you select particular row in the picker.
numberOfRowsInComponent:
- Returns the count of rows in the particluar component.
So inorder to select the last object index, you can make use of this.
[self.pickerView selectRow:[self.pickerView numberOfRowsInComponent:0] inComponent:0 animated:NO];
You can do this using following snippet
[self.pickerView selectRow:MAX_VALUE inComponent:0 animated:NO];
where MAX_VALUE = total no. of rows in component - 1;
Enjoy Programming !!