uislider

How to change size of thumb image of UISlider programmatically

浪尽此生 提交于 2019-12-03 14:02:45
问题 I would like to make the custom UISlider, something like this |o----------| -> |-----O------| -> |------------〇| the thumbImage will be small at the minimum value, it will increase the size during the slider value increase, otherwise it will decrease. is anyone know how to do it? 回答1: You can use this code: + (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize { //UIGraphicsBeginImageContext(newSize); UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0); [image

How to make UISlider output nice rounded numbers exponentially?

折月煮酒 提交于 2019-12-03 13:28:24
I am implementing a UISlider a user can manipulate to set a distance. I have never used the CocoaTouch UISlider, but have used other frameworks sliders, usually there is a variable for setting the "step" and other "helper" properties. The documentation for the UISlider deals only with a max and min value, and the output is always a 6 decimal float with a linear relation to the position of the "slider nob". I guess I will have to implement the desired functionality step by step. To the user, the min/max values range from 10 m to 999 Km, I am trying to implement this in an exponential way, that

about showing continuous slider value in UISlider

核能气质少年 提交于 2019-12-03 13:06:11
Here's what I want to do with UI Slider .... I have a bunch of files with times and I show them based on slider value. The problem is I want to show the slider value when the user is changing/moving the slider. In other words, the value should change (and be shown on the screen) as the user is moving the slider (and not afterwards). Can anyone please give me any idea how to do it ? Thanks. You can ask to get a method called when the slider's value changes. Then using that change, you should update the text of a label. To listen for the value's change: [mySlider addTarget:self action:@selector

How to make UISlider default thumb to be smaller like the ones in the iOS control center

若如初见. 提交于 2019-12-03 13:03:44
I'm working on an app and I have a custom UISlider . However, I'm having some issues on how to make the default thumb to appear smaller like the ones in the iOS control center. Note that I want the same iOS thumb, not a custom thumb image. So far, I've tried thumbRect(forBounds...) but no luck. Any suggestions? Axel Guilmin You can't change the size of the default thumb image, but UISlider has a method setThumbImage(_:for:) that will allow you to pass a similar, smaller image. In your view controller viewDidLoad : let image:UIImage? = // ... yourSlider.setThumbImage(image, for: .normal)

AVPlayer currentTime update for a UISlider when ViewController load

。_饼干妹妹 提交于 2019-12-03 12:50:41
I'm playing songs in AVPlayer . I have created a separate view controller for my media player and initialization, and all the methods that I'm using for the player (play, pause, repeat, shuffle) are there in the same view controller. I update a slider like this: [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(sliderUpdate:) userInfo:nil repeats:YES];` - (void) sliderUpdate:(id) sender{ int currentTime = (int)((song.player.currentTime.value)/song.player.currentTime.timescale); slider.value=currentTime; NSLog(@"%i",currentTime); song.currentTime=currentTime; int

UISlider ignores alpha when set to 0.5

一曲冷凌霜 提交于 2019-12-03 12:48:31
Why does the UISlider view ignore the alpha view when set to 0.5? Code: for (int i = 0; i < 3; i++) { UISlider *slider = [[[UISlider alloc] initWithFrame:CGRectMake(0, i * 30, 200, 30)] autorelease]; slider.alpha = 0.4 + (CGFloat)i / 10.0f; [window addSubview:slider]; } Result: The sliders have alpha values 0.4, 0.5 and 0.6. And as you can see the middle one with 0.5 is completely opaque. It seams to only occur with alpha 0.5. Have tested other UI controllers and they work as expected with alpha is set to 0.5. Reproduced with iOS 4.2 on real device and with iOS 3.2 and 4.2 in simulator. BTW if

UISlider events

删除回忆录丶 提交于 2019-12-03 11:33:12
问题 I'm using an UISlider, its updated automatically except the user is touching the sliderbutton. therefore i did this in the function which updates automatically by an NSTimer: if (!isSliderTouched) { [progressSlider setValue: progressValue]; } How do I track the ending of this event, when the user releases his finger. I want to set isSliderTouched as long as the user interacts with this control. EDIT : this should be the plot: user beginns draging/touching UISlider => isSliderTouched = YES

Tap on UISlider to Set the Value

折月煮酒 提交于 2019-12-03 11:15:20
问题 I created a Slider (operating as control of the video, like YouTube has at the bottom) and set the maximum (duration) and minimum values. And then used SeekToTime to change the currentTime. Now, the user can slide the thumb of the slider to change the value What I want to achieve is letting the user tap on anywhere on the slider and set the current time of the video. I got an approach from this answer, and I tried to apply it to my case, but couldn't make it work class ViewController:

jquery slider with value above it which travels with the slider

徘徊边缘 提交于 2019-12-03 09:48:11
问题 I've made a slider with query/slider and styled it with css. ( http://jsfiddle.net/9qwmX/ ) I succeeded to put the selected value into a div container; but now I want the container to 'travel' with the slider accordingly. I've tried to use the ui.handle and its css left property which is a percentage. But the behavior is somewhat strange: sometimes it travels with the left side of the slider and sometimes with an offset of 10px. Question: does anybody know a good way to let the box containing

Animate UISlider smoothly

坚强是说给别人听的谎言 提交于 2019-12-03 08:05:19
i want to animate an UISlider for e.g. 0.25 to 0.75 and back. This should show the user what is to do. i tried this: [self incrementCounter:[NSNumber numberWithInt:0]]; -(void) incrementCounter:(NSNumber *)i { [Slider setValue:[i floatValue]/1000]; [self performSelector:@selector(incrementCounter:) withObject:[NSNumber numberWithInt:i.intValue+1] afterDelay:0.001]; } but thats not so smooth... can i use transitions for this? [Slider setValue:1 animated:YES]; is to fast... [UIView animateWithDuration:2.0 animations:^{ [Slider setValue:0.2]; }]; [UIView animateWithDuration:2.0 animations:^{