自定义 UIPickerView
我有一个需要自定义 UIPickerView 的要求。选择器视图应如下所示:
类似地定制了pickerView的应用程序是: http://itunes.apple.com/ us/app/convert-the-unit-calculator/id325758140?mt=8
我尝试通过重置 UIImagePicker 的属性 showsSelectionIndicator
并添加覆盖视图来删除默认的 pickerView 选择栏。但问题是,覆盖视图应该是透明的,以便其后面的轮子可见。但即使选择栏不透明,另一个应用程序也会以某种方式执行此操作。
关于如何实现这一壮举有什么想法吗?
谢谢和问候, 拉杰
I have a requirement where UIPickerView should be customized. The picker view should look something like this:
The application which has customized the pickerView similarly is:
http://itunes.apple.com/us/app/convert-the-unit-calculator/id325758140?mt=8
I have tried removing the default pickerView selection bar by resetting the property showsSelectionIndicator
of UIImagePicker and adding a overlay view. But the problem is, the overlay view should be transparent so that the wheel behind it is visible. But the other application somehow does it even though the selection bar is not transparent.
Any ideas on how to achieve this feat?
Thanks and Regards,
Raj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须从头开始编写自己的程序。 UIPickerview 不可自定义。在。全部。糟糕,但就是这样。我首先创建一个 uitableview 并在其周围分层框架,并尝试模仿 uipickerview。
You're going to have to write your own from scratch on this one. UIPickerview isn't customizable. At. All. Sucks, but that's how it is. I'd start out creating a uitableview and layering a frame around it, and trying to mimic uipickerview.
我认为你可以打印选择器下的子视图并修改它们。
UIPickerView 在数据首次加载后创建子视图。
使用performSelecter:WithObject:afterDelay:,您可以删除它们或插入您需要的任何内容。
I think you can print the subviews under the picker and modify them.
The UIPickerView create subviews after the data is first loaded.
With performSelecter:WithObject:afterDelay:, you can remove them or insert whatever you need.