uislider

Touch on UISlider prevents scrolling of UIScrollView

这一生的挚爱 提交于 2019-12-05 17:21:21
问题 I have a (vertical) UISlider inside a UIScrollview. I'd like to be able to change the value of the slider, and, without lifting my finger, scroll the scrollview left or right. Desired behavior: Touch down inside vertical UISlider, followed by a finger drag left or right causes the scrollview to scroll Actual behavior: Touch down inside vertical UISlider, followed by a finger drag left or right causes no movement in UIScrollview. A touch down outside the UISlider followed by a drag will scroll

UISlider won't work when it becomes a subview of a UIView other self.view

萝らか妹 提交于 2019-12-05 08:48:23
When I add my slider as subview of any view besides self.view it does not work (doesn't slide) but it works fine when it is a subview of self.view. You can see it on the other views besides self.view but it doesn't work. Here is my code: alphaSlider = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 90, 10)]; [alphaSlider setMinimumValue:0.01]; [alphaSlider setMaximumValue:1]; [alphaSlider setValue:0.5]; [alphaSlider setUserInteractionEnabled:YES]; [alphaSlider addTarget:self action:@selector(alphaSliderDidChange:) forControlEvents:UIControlEventValueChanged]; alphaSlider.continuous = YES;

Observing a UISlider's value - iPhone KVO

感情迁移 提交于 2019-12-05 08:26:54
By default, when I observe the value of a UISlider, it only updates once, when the slider is clicked, not continuously, even thought that is the slider's setting. Is there a way to get the continuous value change of the slider? UIKit doesn't actively support KVO. You may be getting lucky in that some notifications may make it through the usual mechanisms, but for the most part you shouldn't assume you can use KVO with any UIKit class. You should instead get your continuous events through the UISlider's associated target's action method. the continuous updating applies to the calling of the

Size of default thumb image for iOS slider?

你说的曾经没有我的故事 提交于 2019-12-05 06:16:59
What is the exact size (width, height) of the (default) thumb image for the iOS slider? Is there perhaps some clever way to coax this out of the system (XCode, iOS)? I tried int thumbWidth = slider.currentThumbImage.size.width; which I found here on this site, but it comes back with 0. Additional question: The Xcode debugger shows this undocumented variable in the UISlider : CGFloat _hitOffset . Does anyone by chance know what it is and what it's for? What about this? Works for me: CGRect trackRect = [self trackRectForBounds:self.bounds]; CGRect thumbRect = [self thumbRectForBounds:self.bounds

Continuously change value of UILabel on thumb image of UISlider

空扰寡人 提交于 2019-12-05 02:00:02
问题 I have a UISlider (min 1 ,max 10). I want its thumb to have a UILabel placed on top of it that continuously updates and changes its text on moving the UISlider 's thumb. So, I grabbed thumb image from the UISlider and added a UILabel to it but the label seems to overwrite itself without erasing the previous value once the thumb is moved. - (IBAction)SnoozeSliderValueChanged:(id)sender { UIImageView *handleView = [_snoozeSlider.subviews lastObject]; UILabel *label = [[UILabel alloc]

UISlider inside UIPageViewController

痴心易碎 提交于 2019-12-05 01:55:13
I have a PageViewController which is initialized like this: self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; On one of the pages, there's a UISlider. My problem is that when I have transitionstyle set to UIPageViewControllerTransitionStyleScroll , it takes 150-200 ms before beginTrackingWithTouch is invoked on the slider. This behavior is not seen when I use UIPageViewControllerTransitionStylePageCurl , where the UISlider is selected

I need a UISlider with value on the handle [closed]

对着背影说爱祢 提交于 2019-12-04 22:09:48
I need to make a UISlider in my iOS App with the value of the slider in the handle. Demo image of what I mean: Is there a pod that could do it? You dont need neither any third party control nor you will have to create a slider on your own. You can still use the UISlider and customise it as per your need :) Step 1: As we can see we need to set the colour for minimum track and as it is not default white isn't it ??? Its somewhat orange, I dont know exact coolor of it hence am setting it to red. You set whatever colour you want :) But UISlider's setMinimumTrackImage expects a UIImage not colour.

UISlider with certain possible values

与世无争的帅哥 提交于 2019-12-04 17:06:34
I am willing to do this widget: Just A-B-C can be chosen. Any idea if someone already did something similar? If not, how would you do it? Personally I'd use a standard UISlider and add logic to the valueChanged handler, so that once the user has dragged the slider to an arbitrary point on the scale, the code determines which is the nearest 'valid' value, and would manually set the value to a valid number. E.g. if the user drags the slider to 0.9, the distances to valid points are 0.9 (to A), 0.4 (to B) and 0.1 (to C). So the code would pick C, and set slider.value to 1.0. Can't remember off

Change the size of a UISlider thumbImage

老子叫甜甜 提交于 2019-12-04 15:29:10
How can I change the size of a UIImage that I am using as a thumbImage. The code I use to set the image is as follows. let image: UIImage = UIImage(assetIdentifier: UIImage.AssetIdentifier.Slider) I use an Enum to get the image, no problem there. The code I use to set the thumbImage is as follows. self.setThumbImage(image, forState: UIControlState.Normal) I have tried using the code below to change the thumb images size but cannot find the solution. let trackRect: CGRect = CGRect(x: 0.0, y: 0, width: self.frame.size.width, height: self.frame.size.height) let thumbRect: CGRect = CGRect(x: 0.0,

Customizing HTML range input with a floating DIV that contains current value

元气小坏坏 提交于 2019-12-04 07:47:00
I'd like to create a range slider that has a div element follow the range thumb. This div element would contain the current value of the range input. How would I go about doing something like this? I've looked into styling the slider but don't know how I could add an actual element onto the thumb. It would look something like this, excuse my terrible drawing abilities: Edit: The following div should update while slider is being dragged. UPDATE: I got a pretty good prototype going but cant seem to get it to follow the slider perfectly. It gets off center by a few pixels depending on where it is