Make UISlider height larger?

The accepted answer will undesirably change the slider’s width in some cases, like if you’re using a minimumValueImage and maximumValueImage. If you only want to change the height and leave everything else alone, then use this code: override func trackRect(forBounds bounds: CGRect) -> CGRect { var newBounds = super.trackRect(forBounds: bounds) newBounds.size.height = 12 return newBounds … Read more

How to put UISlider vertical?

You have to do this programaticaly. Assuming your UISlider is bound to a variable called slider, add this code in your viewDidLoad method in ViewController.m: – (void)viewDidLoad { [super viewDidLoad]; CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI * 0.5); slider.transform = trans; } Let me know if you need any more help on this..

Implementing steps/snapping UISlider

It’s actually considerably easier than I first thought. Originally I was trying to get the thumbrect property and do complicated math. Here’s what I ended up with: h File: @property (nonatomic, retain) IBOutlet UISlider* questionSlider; @property (nonatomic) float lastQuestionStep; @property (nonatomic) float stepValue; m File: – (void)viewDidLoad { [super viewDidLoad]; // Set the step to … Read more

UISlider that snaps to a fixed number of steps (like Text Size in the iOS 7 Settings app)

Some of the other answers work, but this will give you the same fixed space between every position in your slider. In this example you treat the slider positions as indexes to an array which contains the actual numeric values you are interested in. @interface MyViewController : UIViewController { UISlider *slider; NSArray *numbers; } @end … Read more

What gets called when a UISlider value changes?

In IB, you can hook up an IBAction to the Value Changed event or in code add target/action for UIControlEventValueChanged. For example: [mySlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged]; – (IBAction)sliderValueChanged:(UISlider *)sender { NSLog(@”slider value = %f”, sender.value); } Note that if you want the value change events as the user is sliding, then be sure that the … Read more

UISlider with increments of 5

Add a target like this: slider.continuous = YES; [slider addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; And in the valueChanged function set the value to the closest value that is divisible by 5. [slider setValue:((int)((slider.value + 2.5) / 5) * 5) animated:NO]; So if you need any interval other than 5 simply set it like so: float interval = … Read more

Slide a layout up from bottom of screen

Use these animations: bottom_up.xml <?xml version=”1.0″ encoding=”utf-8″?> <set xmlns:android=”http://schemas.android.com/apk/res/android”> <translate android:fromYDelta=”75%p” android:toYDelta=”0%p” android:fillAfter=”true” android:duration=”500″/> </set> bottom_down.xml <?xml version=”1.0″ encoding=”utf-8″?> <set xmlns:android=”http://schemas.android.com/apk/res/android”> <translate android:fromYDelta=”0%p” android:toYDelta=”100%p” android:fillAfter=”true” android:interpolator=”@android:anim/linear_interpolator” android:duration=”500″ /> </set> Use this code in your activity for hiding/animating your view: Animation bottomUp = AnimationUtils.loadAnimation(getContext(), R.anim.bottom_up); ViewGroup hiddenPanel = (ViewGroup)findViewById(R.id.hidden_panel); hiddenPanel.startAnimation(bottomUp); hiddenPanel.setVisibility(View.VISIBLE);