Search code examples
iosobjective-cuipickerviewuislider

Customize iOS component to make something like pickerview


How can I make this picker/slider or whatever view?enter image description here

It is given to me by a designer and I have no Idea how to make it!


Solution

  • This is not a really easy task, there are different roads that you can take, but the one that makes more sense to me is subclass UIControl.
    UIControl is a subclass of UIView, the main difference is that it's ready to work with the target-action pattern and gives you the possibility to track touches without adding gesture recognizer. A lot of UI interactive elements are concrete subclasses of UIControl, for instance UIButton. Ray's site has interesting tutorial about how to do that.
    Probably the harder part is integrating autolayout programmatically to make it adapt to any size of views.
    This is the log hard road that provides the most reliable solution, but I think that you can achieve something similar compositing your own UIView subclass using a customized slider and some labels.