底部弹出UIPicker?
调用action时从屏幕底部弹出的UIPicker是否只是一个以某种方式协调的基本UIPickerView? (就像 UIActionSheet 一样?)我将如何实现它?
Is the UIPicker that pops up from the bottom of the screen when an action is called just a basic UIPickerView that is coordinated in a certain way? (Like a UIActionSheet?) How would I implement that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是我使用的动画代码:
datePickerView 是一个视图,其中包含 DatePicker:
parentViewController 应该实现 addSubviewToWindow 方法:
UIColorMakeRGBA:
slideDownDidStop 是一个方法,在 datePicker 成功向下滑动后将调用该方法。
所以,总结一下 - 你有 MyViewController,它有
字段。
MyDatePickerView 是一个自定义类,具有 UIDatePicker *datePicker 字段、MyViewController *parentViewController 和 animateDatePicker 方法。
当您在 MyViewController 上执行某些操作(例如,对某些按钮执行 UIControlEventTouchUpInside)时,您应该调用“
如果您有疑问,请告诉我”。
更新:
这是一个小示例。
Here's animation code, that I use:
datePickerView is a view, that contains DatePicker:
parentViewController should implement addSubviewToWindow method:
UIColorMakeRGBA:
slideDownDidStop is a method, that will be called after datePicker slide down successfully.
So, just to summarize - you have MyViewController, that have
field.
MyDatePickerView is a custom class, that have UIDatePicker *datePicker field, MyViewController *parentViewController and animateDatePicker method.
When you perform some action on MyViewController (for example, UIControlEventTouchUpInside for some button), you should invoke
Please let me know if you have questions.
UPDATE:
Here's a small example.
将 UIPickerView 放入新的 UIViewController 类中(我们称之为 PopupUIPicker),然后通过以下方式显示该视图控制器:
其中 currentViewController 是要在其上显示它的视图控制器。关闭它:
默认动画是从底部向上滑动。您可以将其更改为:
Put a UIPickerView in a new UIViewController class (let's call it PopupUIPicker) and then display that View Controller via:
Where currentViewController is the View Controller you want to display it on. To dismiss it:
The default animation is to slide up from the bottom. You can change it like:
“调用操作时从屏幕底部弹出的 UIPicker”是什么意思?
如果您想大致了解 Facebook 应用程序的功能,请查找 Three20,这是他们的开源 UI库(不能保证他们使用的组件在那里;我没有检查过)。
What do you mean by "the UIPicker that pops up from the bottom of the screen when an action is called"?
If you want to do roughly what the Facebook app does, look up Three20 which is their open-source UI library (no guarantee that the component they use is there; I haven't checked).
我和 Rob 有同样的问题...我可以弹出 UIPicker...但它填满整个屏幕...我只想弹出选择器...Matt 说你不必制作视图占据整个框架...调整视图大小不起作用...如何使选择器弹出?我仍然可以看到父视图的一部分...就像 iphone 上的 safari 处理下拉菜单一样。
I have the same issue as as Rob... I can make the UIPicker popup... but it fills the whole screen... i want just the picker to popup... Matt says you don't have to make the view take up the entire frame ... resizing the view along does not work... How do you make just the picker pop up? i was to still see the part of the parent view... much like safari on iphone handles dropdowns.