Insert blank value in date picker in Iphone

这一生的挚爱 提交于 2019-12-10 15:56:07

问题


I have a date picker which is shown using an action sheet. I want to insert a blank value in date picker and set it as default value. It should change only on user selection. Is this possible? If yes how? All valuable suggestions are appreciated.


回答1:


UIDatePicker only supports certain modes and doesn't allow this kind of customization (adding in blank or custom data into the spinning pickers). Oh, the documentation indicates it doesn't inherit from UIPickerView either so you can't easily get at the custom picker-view object that it works with.

Why not create your own view and controller pair that implements the UIPickerViewDelegate and create your own - you may find a little more detail and useful hints in this related question.

Or, consider a different & less painful way to accomplish what you're trying to do.



来源:https://stackoverflow.com/questions/8501542/insert-blank-value-in-date-picker-in-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!