开发者

How to approach pre-selected values in UIPickerView?

I have a couple (4) UIPickerViews and one UIDatePicker.

I want to pre-select values in them.

My structure is basically, that when a tablerow gets tapped, an actionshe开发者_如何学Cet is made, the pickerview placed on it with a tag to differentiate the different possible ones, and it is then presented to the user.

I tried using the selectRow method in titleForRow, but that lead to some values being invisible until i started scrolling the picker.

All suggestions are welcome.


It is not clear without seeing your code but your implementation should add the picker view and call selectRow on it probably from the same method. Your titleForRow shouldn't be calling selectRow, it should only return the title.

If you can only work out which row should be selected during your titleForRow implementation, then you need to re-think your design - your data source for the picker view should perhaps be set up in advance so you know which row is going to be selected.

If you could update your question with some code (particularly where you show the picker, and your titleForRow) it might be clearer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜