uislider

Implementing steps/snapping UISlider

不想你离开。 提交于 2019-11-29 19:57:40
I am trying to implement some form of snapping or steps with the UISlider. I have written the following code but it does not work as smooth as I hoped for. It works, but when the I slide it upwards it snap 5points to the right leaving the finger not centered over the "slide-circle" This is my code where self.lastQuestionSliderValue is a property of the class which I have set to the initial value of the slider. if (self.questionSlider.value > self.lastQuestionSliderValue) { self.questionSlider.value += 5.0; } else { self.questionSlider.value -= 5.0; } self.lastQuestionSliderValue = (int)self

UISlider setMaximumTrackTintColor

白昼怎懂夜的黑 提交于 2019-11-29 17:22:20
问题 I'm trying to dynamically configure the track color on a UISlider. This line of code works perfectly for setting the low side of the slider track. [self.sliderBar setMinimumTrackTintColor:[UIColor redColor]]; When trying to do the same thing for the high side of the slider track, this line of code reports 3 fatal errors to the debug log. [self.sliderBar setMaximumTrackTintColor:[UIColor redColor]]; <Error>: CGContextAddPath: invalid context 0x0. This is a serious error. This application, or a

adjusting label to slider value swift

放肆的年华 提交于 2019-11-29 16:48:46
问题 I have a slider and label in my swift project. On the storyboard, I control dragged my slider onto my controller class for that page and created an outlet and also an action. I control dragged another label as an outlet. I am trying to update the label based on the slider's value. I don't know where i am going wrong. Code: @IBOutlet weak var slider: UISlider! @IBOutlet weak var sliderVal: UILabel! @IBAction func sliderValueChanged(sender: UISlider) { var currentValue = Int(sender.value)

Increment UISlider by 0.2 in range 0 to 2.0 [duplicate]

你离开我真会死。 提交于 2019-11-29 13:01:54
Possible Duplicate: Increment UISlider by 1 in range 1 to 100 I am new to iPhone, How do I have my UISlider go from 0 to 2 in increments of 0.2? slider = [[UISlider alloc] init]; [slider addTarget:self action:@selector(sliderChange:) forControlEvents:UIControlEventValueChanged]; [slider setBackgroundColor:[UIColor clearColor]]; slider.minimumValue = 0.0; slider.maximumValue = 2.0; slider.continuous = YES; slider.value = 0.0; - (IBAction)sliderChange:(id)sender{ NSLog(@"slider.value=%f",slider.value); } When i slide my log shows... slider.value = 1.000000 slider.value = 1.123440 slider.value =

Image auto-rotates after using CIFilter

北战南征 提交于 2019-11-29 11:42:28
I am writing an app that lets users take a picture and then edit it. I am working on implementing tools with UISliders for brightness/contrast/saturation and am using the Core Image Filter class to do so. When I open the app, I can take a picture and display it correctly. However, if I choose to edit a picture, and then use any of the described slider tools, the image will rotate counterclockwise 90 degrees. Here's the code in question: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.navigationItem.hidesBackButton = YES; //hide default nav /

How to detect AVPlayer actually started to play in swift

故事扮演 提交于 2019-11-29 09:08:38
Hello I have set my UISlider minimum value to 0.00. Then I set it's max value in this way. self.viewPlayer.layer.addSublayer(playerLayer) let duration : CMTime = avPlayer.avPlayer.currentItem!.asset.duration let seconds : Float64 = CMTimeGetSeconds(duration) sliderBar.maximumValue=Float(seconds) sliderBar!.isContinuous = false sliderBar!.tintColor = UIColor.green But I am getting this exception *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to set a slider's minimumValue (0.000000) to be larger than the maximumValue (nan)' enter code here

jquery ui slider display values

筅森魡賤 提交于 2019-11-29 07:56:03
问题 I have a slider with values 1 - 5. it updates a hidden input with the ID of 'days'. $(function() { $("#slider").slider({ value: 3, min: 1, max: 5, step: 1, slide: function(event, ui) { $("#days").val(ui.value); } }); $("#days").val($("#slider").slider("value")); });​ I want to add labels to the slider so at position 1 it would say 1 hour, 2 would say 12 hours, 3 would say 1 day, 4 = 3 days and 5 = 1 week. but i want to keep the value of days as 1 -5 how is this possible? EDIT Want to copy

Setting interval value for UISlider

ぐ巨炮叔叔 提交于 2019-11-29 06:48:45
I need to set the interval value for an UISlider. Please help.. yourSlider.value = x; You should really read the documentation, lots of great resources in the iOS Developer Center . Edit: With regards to your more specific question in the comments: yourSlider.minimumValue = -10; yourSlider.maximumValue = 10; [yourSlider addTarget:self action:@selector(roundValue) forControlEvents:UIControlEventValueChanged]; - (void)roundValue{ yourSlider.value = round(yourSlider.value); } A flexible solution: // define MIN_VALUE, MAX_VALUE and INTERVAL somewhere, such as 3, 18 and 3 slider.TouchUpInside +=

What gets called when a UISlider value changes?

孤人 提交于 2019-11-28 17:42:38
Does a method get called when a UISlider 's value changes? I want to be able to update a value based on the UISliders value, but only when it changes... Thanks for any help. 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

iOS how to make slider stop at discrete points

限于喜欢 提交于 2019-11-28 17:25:58
I would like to make a slider stop at discrete points that represent integers on a timeline. What's the best way to do this? I don't want any values in between. It would be great if the slider could "snap" to position at each discrete point as well. To make the slider "stick" at specific points, your viewcontroller should, in the valueChanged method linked to from the slider, determine the appropriate rounded from the slider's value and then use setValue: animated: to move the slider to the appropriate place. So, if your slider goes from 0 to 2, and the user changes it to 0.75, you assume this