开发者

UIPickerView - changing component width

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 sel开发者_开发技巧ect 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


You may use [pickerView reloadAllComponents].

Update:

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


Just a reload won't work. You also need to call setNeedsLayout

[pickerView reloadAllComponents];
[pickerView setNeedsLayout];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜