Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical UISliders and UISwitches

Tags:

ios

iphone

Is it possible to set up UISwitches and UISliders vertically rather than horizontally?

like image 402
some_id Avatar asked Mar 09 '11 02:03

some_id


3 Answers

As like Caleb said, it may violate the guideline.But am not sure about that.

If you really want to change the here is a sample ,

urSlider.transform=CGAffineTransformRotate(urSlider.transform,270.0/180*M_PI);

The above code will change the slider position from horizontal to vertical.Same like this you can do for UISwitch.

like image 152
EXC_BAD_ACCESS Avatar answered Nov 18 '22 10:11

EXC_BAD_ACCESS


I am looking to do the same. From the Apple Developer Site iOS UI Element Usage Guidelines:

Slider

Appearance and Behavior

A slider consists of a track and a thumb (a circular control that the user can slide) and optional images that convey the meaning of the right and left values. When people drag the thumb along the slider, the value or process is updated continuously and is displayed in the track.

Guidelines

Use a slider to give users fine-grained control over values they can choose or the operation of the current process.

If appropriate, customize the appearance of a slider. For example, you can do any of the following:

Display a slider either horizontally or vertically.

Set the width of a slider to fit in with the UI of your app.

Define the appearance of the thumb, so that users can see at a glance whether the slider is active.

Supply images to appear at both ends of the slider to help users understand what the slider does.Typically, these custom images correspond to the minimum and maximum values of the value range that the slider controls. A slider that controls font size, for example, could display a very small character at the minimum end and a very large character at the maximum end.

Define a different appearance for the track, depending on which side of the thumb it is on and which state the control is in.


There do not seem to be prohibitions against changing switches, steppers, and segmented controls. However, permission does not appear to be explicitly granted for those controls.

like image 8
ICL1901 Avatar answered Nov 18 '22 11:11

ICL1901


While it's not a good idea to modify the standard iOS controls like UISlider or UISwitch, it's very easy to write your own custom UIControl. See Mike Ash's "Diagonal Slider" post

like image 4
Jamie Pinkham Avatar answered Nov 18 '22 09:11

Jamie Pinkham