如何在 UIActionSheet 中创建 UIPickerView
只是想知道如何使用简单的数组在 UIActionSheet 中创建 UIPickerView 。
好吧,我实际上找到了如何将其放入操作表中,但我更喜欢你的方式,因为它更适用于我的应用程序,谢谢,但我也想知道如何将选项放入 UIPickerView 中,我只是挂断了那部分。我已经有一个包含颜色的数组:红色、绿色、蓝色、黄色、黑色等,但我想知道如果我已经使用过 initwithframe: ,如何将其放入 pickerview 中?请任何人帮忙,我知道这是一个愚蠢的问题,但我正在我的 $$$$$$ Macbook 上绞尽脑汁。
Just want to know how I would make a UIPickerView in a UIActionSheet with a simple array.
Ok well I actually found out how to put it into an action sheet but I like your way better because it applies more to my app, thanks, but I want to also know how put the options into the UIPickerView, I am just hung up on that part of that. I already have an array with the colors: red, green, blue, yellow, black, etc in it but I want to know how to put that into the pickerview if I have already used initwithframe:? Please anyone help I know it is a stupid question but I'm racking my head on my $$$$$$ Macbook.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不想那样做。相反,在 Interface Builder 中创建 UIPickerView 并将其连接到视图控制器中的 Outlet。将其添加为主视图的子视图并设置其框架坐标,使其位于屏幕外的底部边缘下方,x=0,y=480。
然后,当您想要显示选择器时,将其动画到屏幕上,如下所示:
然后在完成选择后隐藏它:
这将导致您的选择器从动画底部向上滑动,并在您选择时向下滑动完成了。
我不认为向 UIActionSheet 添加选择器(如果可能的话)是可取的。
You don't want to do that. Instead, create your UIPickerView in Interface Builder and connect it to an Outlet in your view controller. Add it as a subview of your main view and set its frame coordinates so that it is offscreen just below the bottom edge, x=0, y=480.
Then, when you want to display the picker, animate it onto the screen with something like:
And then hide it when you're done picking with this:
This will cause your picker to slide up from the bottom animated and slide back down when you're done.
I don't think adding a picker to a UIActionSheet, if it's even possible, is advisable.