I've only seen it in a VERY few iPhone apps... but it looks like a picker that rotates left/right (instead of top/bottom).
They usually put it on 1 line of a tableView... to allow the user to quickly pick between a small number of choices (like 3-10).
How is that coded?
Try a paged scrollview that has the items you want on one per page, and perhaps overlay an image above it if you want nicer graphics for your control, and only allow for horizontal scrolling (don't make the contentSize of the scrollview taller than the size of the actual view, and disable vertical scroll bouncing on the control).
You will have to create picker programitcally, so that you can create your own sized picker with
CGRectMake(x, y, width, height)
then, you will have to rotate it, but rotating it will also rotate in the Picker's dataSources methods, you will have to rotate the view inverse of picker's rotation, I am including code hopfully it will helpHave you ever considered taking a table view and rotating it?
Didn't think so. Go try that. :)
@Madhup's code lead me in the general direction I wanted when I searched for the horizontal
UIPickerView
but I then realized the question asked wasn't really addressed so for anyone who was looking for a more suitable answer to the left-to-right rotation. The code in the answers I'd read were all to enable left-to-right swiping, causing the picker to push the labels/rows with higher values to the left of the view. Any ways here's my contribution:In the
viewDidLoad
method:The
pickerView
's method:You can do this by taking a regular UIPickerView, adjusting its width (via
setFrame:
), and then applying an NSAffineTransform to rotate it 90º. You'll then need to rotate each item in the picker 90º the other way.It's a little tedious to do it properly, but it can be done.
Here you will find source code for Picker which is horizontally aligned.