views:

127

answers:

1

In my iPhone app I want to have a UIPickerView with 2 components. Initially the left column will be wide and the right column narrow to enable the text on the left to be read easily to allow selection from it.

Once this column has been selected the user will click on the right column to select an item from it : when this happens I want to resize the columns so that the left column is narrow and the right one is wide so that all the text can be read.

I have been experimenting with "pickerView widthForComponent" but this seems to only get called when the view is initially loaded.

Is there any way I can dynamically resize the columns ?

Thanks

A: 

You may use [pickerView reloadAllComponents].

Update:

That's weird. You may also try to check the following solution.

kovpas
I tried that, but 'pickerView widthForComponent' doesn't get called again.
Hi Kovpas - thanks very much ! That solution does the trick :-)In 'didSelectRow' adding "self.pickerView.delegate = nil; self.pickerView.delegate = self;"To reset the picker's delegate causes the component widths to be redrawn.