tags:

views:

1452

answers:

1

Hello there, Im using a navigation controller and a normal view. In the view I'd like a UIPickerView with custom values in it. It would have one column with about 15 values in it. And I want the ability to add an action to each value.

Is there any way I can do this using Xcode? I can't seem to find the corrent help.

Cheers.

+1  A: 

You need to look at the documentation for UIPickerViewDelegate.

In order to have an action for each value you will implement pickerView:didSelectRow:inComponent: and have a different action based on which row was selected.

For the contents of the rows you can implement pickerView:titleForRow:forComponent: if your contents are simple text.

If you want custom drawn contents you can provide a custom view for each row with the pickerView:viewForRow:forComponent:reusingView: method.

See the UICatalog example that is available in the iPhone Developer examples.

Paul Robinson