uislider

How To Make UISlider match Audio progress

可紊 提交于 2019-12-12 15:10:24
问题 I am creating a simple music app, and I was wondering how I can make a UiSlider to follow the progress of a audio file. Here's my project so far: Code: import UIKit import AVFoundation class SongDetailViewController: UITableViewController { var audioPlayer = AVAudioPlayer() override func viewDidLoad() { super.viewDidLoad() do { audioPlayer = try AVAudioPlayer(contentsOf: URL.init(fileURLWithPath: Bundle.main.path(forResource: "Song Name", ofType: "mp3")!)) audioPlayer.prepareToPlay() var

UISlider with thumb center over the start and end of track

早过忘川 提交于 2019-12-12 10:59:17
问题 The default behaviour of UISlider is that its thumb isn't centered on start/end of track. Like below: I would like to modify it's behaviour to get: where thumb's center can be positioned on start or end. I have tried to cover start/end with empty UIView . Effect is that is look almost ok, but thumb has dropshadow that reveals my hack in some positions (which I can live with), however my hacky view covers a little the thumb and captures it's touch event (even when user interactions are

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

跟風遠走 提交于 2019-12-12 08:49:55
问题 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

How to change a UISlider value using a single touch?

早过忘川 提交于 2019-12-12 07:48:10
问题 I'm developing my first iOS app which contains a UISlider . I know how to get the value when the UISlider is dragged. But for my app I need to get the slider's value in a single touch; i.e. if I touch somewhere in the UISlider , a UILabel should display its correct value. Is it possible to this way. Any tutorial or code will very helpful. 回答1: Please Write Following Code may be helpful for you :) Here tapCount is int variable that declare in .h file - (void)viewDidLoad { tapCount = 0; //

jquery sliders not working when loading through ajax

落花浮王杯 提交于 2019-12-12 06:23:09
问题 I am using the jquery slider plugin to create some sliders. This works fine when I load them directly when the dom is initiated however when I try to load the sliders into a div using the ajax innerHTML method they do not get intiated. Does anything know how I can do this? 回答1: You have to initiate / bind your events again. e.g //Ajax done and innerHTML is set $('container').slider(); //Just an example... this will bind events. Or You can change the event handlers to .live . This handles

How to change UISlider Thumb Appearance when Touch Ends

China☆狼群 提交于 2019-12-12 04:25:53
问题 I am changing the color of a UISlider by calling .thumbTintColor @IBAction func slider1Master(sender: AnyObject) { slider1.thumbTintColor = UIColor.orangeColor()} It works, but I want the color to change back to it's original state when the touch ends (user lifts finger). Does anyone have any suggestions? Thank you. 回答1: You can use " setThumbImage " instead. Then you have the option of setting an image for a specific state of action. For the image, just create a rounder image with the color

AVAudioPlayer Duration Changing

隐身守侯 提交于 2019-12-12 03:56:01
问题 My app uses AVAudioPlayer to play music files. It also has a UISlider to adjust where in the song it is playing back. However, there is an odd bug with the UISlider in that it seems to be changing the audioPlayer's duration. When a song is started, as part of the process, values are set like so: audioPlayer.currentTime = 0; seekingSlider.maximumValue = [audioPlayer duration]; seekingSlider.value = audioPlayer.currentTime; This works no problem. I then have an NSTimer that updates the

Getting negative value when UISlider goes left

倖福魔咒の 提交于 2019-12-12 03:14:39
问题 I was trying to figure out how to get a negative value of the slider when it goes back. When I slide from left to right it returns a positive value. I need it to return a negative value when it goes back (from right to left). In other words, how could I detect that the slider is going back? self.borderSlider = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 200, 30)]; self.borderSlider.center = CGPointMake(self.view.centerX, SCREEN_WIDTH / 2); self.borderSlider.minimumValue = 0.0f; self

How to add different color in a UI slider in IOS?

妖精的绣舞 提交于 2019-12-12 01:53:31
问题 I am building an iOS application where I am using 2 sliders on the same bar for selecting max and min values. I have taken reference of the below link and I am using Point feedback slider. Reference Link Now the problem I am facing is that I want that 10-20 should be of green color and 80-90 should be of red color rest should be black color. PLease help I am new in iOS . 回答1: To change the color of mimimum track of slider @property(nonatomic, strong) IBOutlet UISlider *slider; [self

UIView animateWithDuration not working with UISlider

北城余情 提交于 2019-12-11 19:37:34
问题 I want the slider to set value slowly and for that I am using this code [UIView animateWithDuration:2.0 animations:^{ [self.slider setValue:(float)val]; }]; But this is not working. Please help me out. 回答1: Use [self.slider setValue:(float)val animated:YES]; instead. 回答2: What I have found is that the animation will not work is the animation is scheduled while the view is still loading. So instead of this (which does not animate): -(void)animateSlider: duration:(NSTimeInterval)duration {