简体   繁体   English

iOS 6自定义UIPicker

[英]iOS 6 Custom UIPicker

I designed a custom UIPicker for my iOS app and now i don't know how to implement it. 我为我的iOS应用程序设计了一个自定义UIPicker,现在我不知道如何实现它。 I am new to iOS and i thought the Picker would be customizable but i think i was wrong. 我是iOS的新手,我认为Picker是可自定义的,但我认为我错了。

Here is an image of it: 这是它的图像:

自定义iOS UIPicker

It's very minimalistic and simple so i think there has to be a way to implement it somehow? 它非常简约和简单,因此我认为必须以某种方式实现它? It would have 2 components and should behave as a usual UIPicker. 它具有2个组件,并且应具有通常的UIPicker行为。

As far as i have seen the UIPicker class is only customizable to a certain degree, like changing the font size but not nearly as much as i would need it. 据我所知,UIPicker类只能在一定程度上进行自定义,例如更改字体大小,但没有达到我的需要。

If your set of values is fairly small you could use two vertical UIScrollViews side-by-side, with a tall content area containing all your values. 如果值的集合很小,则可以并排使用两个垂直的UIScrollViews,其中一个高内容区域包含所有值。

Set the scrollviews to to 'paged' mode (where the page size is the height of one of your digits) - so the scrolling stops at each digit. 将滚动视图设置为“分页”模式(其中页面大小是一位数字的高度)-因此滚动在每一位停止。

I think that'd work fine. 我认为那很好。 If you have a huge number of possible values it'd take a lot of memory, but for a few it'd work. 如果您拥有大量可能的值,它将占用大量内存,但是对于少数几个,它将起作用。

EDIT: Looks like this control http://www.cocoacontrols.com/platforms/ios/controls/slnumberpickerview could be a useful starting point for customisation. 编辑:看起来此控件http://www.cocoacontrols.com/platforms/ios/controls/slnumberpickerview可能是自定义的有用起点。 Haven't tried it myself. 我自己还没有尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM