How to make a UIDatePicker appear at bottom of screen?

元气小坏坏 提交于 2020-01-13 04:12:11

问题


I currently use MonoTouch with MonoTouch.Dialog. When tapping on a date field it pushes the navigationcontroller so you go right a screen to see your UIDatePicker where you choose the date then go "back" to the main screen again. I'd really like to have this UI like other apps I've used that when you select a date field the UIDatePicker appears at the bottom of the current screen.

I would like to learn how to do this and apply it to other input fields where I may want to use a custom picker that also presents itself at the bottom of the current screen.

Does anyone have any code to share that would allow a UIPicker/UIDatePicker to appear at the bottom of the active screen?

Thank you.


回答1:


You just create a UIPickerView normally, but set its frame outside of the visible area. Once you click on a cell, you change the origin point of the UIPickerView's frame, so that the picker view will become visible. You can animate the property frame, so you can make a nice soft animation that your picker view will slide in from the lower boundary of the phone.



来源:https://stackoverflow.com/questions/3494348/how-to-make-a-uidatepicker-appear-at-bottom-of-screen

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