uislider

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

夙愿已清 提交于 2019-11-27 09:04:33
问题 I'm trying to create a UISlider that lets you choose from an array of numbers. Each slider position should be equidistant and the slider should snap to each position, rather than smoothly slide between them. (This is the behavior of the slider in Settings > General > Text Size , which was introduced in iOS 7.) The numbers I want to choose from are: -3, 0, 2, 4, 7, 10, and 12. (I'm very new to Objective-C, so a complete code example would be much more helpful than a code snippet. =) 回答1: Some

UISlider to control AVAudioPlayer

本秂侑毒 提交于 2019-11-27 06:58:29
I'm trying to implement a little function in my app. I am currently playing sounds as AVAudioPlayers and that works fine. What I would like to add is to control the sound's position (currentTime) with an UISlider: is there a simple way to do it ? I looked at an Apple project but it was quite messy....have you got samples or suggestions ? Thanks to everyone in advance To extend on paull's answer, you'd set the slider to be continuous with a maximum value of your audio player's duration , then add some object of yours (probably the view controller) as a target for the slider's

Customizing UISlider look

喜夏-厌秋 提交于 2019-11-27 05:57:31
问题 To customize the visual look of a UISlider you can set the thumb and track images. Part of the track images gets stretched to the appropriate with. From the documentation: A stretchable region sits between two end cap regions. The end caps define the portions of the image that remain as is and are not stretched. The stretchable region is a 1-point wide area between the end caps that can be replicated to make the image appear longer. Now the problem I have is that my stretchable region needs

Custom UISlider - Increase “hot spot” size

◇◆丶佛笑我妖孽 提交于 2019-11-27 05:33:50
问题 I have a custom UISlider that is relatively tough for big fingered people to grab hold of and slide due to the size of the "thumb image". Is there any way to increase the size of clickable / draggable area without altering the size of the image? Here's the code I have for creating the custom slider if that helps: [slider setMaximumTrackImage:[[UIImage imageNamed:@"max.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 20, 0, 20)] forState:UIControlStateNormal]; [slider setMinimumTrackImage

iPhone : How to detect the end of slider drag?

痞子三分冷 提交于 2019-11-27 05:11:11
问题 How to detect the event when the user has ended the drag of a slider pointer? 回答1: If you don't need any data inbetween drag, than you should simply set: [mySlider setContinuous: NO]; This way you will receive valueChanged event only when the user stops moving the slider. 回答2: You can add an action that takes two parameters, sender and an event, for UIControlEventValueChanged: [slider addTarget:self action:@selector(onSliderValChanged:forEvent:) forControlEvents:UIControlEventValueChanged]

How to customise UISlider height

自作多情 提交于 2019-11-27 03:19:05
问题 I have project in which have to customise UISlider element. I wondering if someone knows how to change, or is it possible to change height of UISlide bar line. I tried something like this but don't work: let customBounds = CGRect(origin: bounds.origin, size: CGSize(width: bounds.size.width, height: 15.0)) feedbackSlider.trackRectForBounds(customBounds) Thanks 回答1: i hope that you want edit it in storyboard, and only the line size, use it in your custom UISlider class CustomSlide: UISlider {

UISlider with ProgressView combined

限于喜欢 提交于 2019-11-26 23:32:04
Is there an apple-house-made way to get a UISlider with a ProgressView. This is used by many streaming applications e.g. native quicktimeplayer or youtube. (Just to be sure: i'm only in the visualization interested) cheers Simon Here's a simple version of what you're describing. It is "simple" in the sense that I didn't bother trying to add the shading and other subtleties. But it's easy to construct and you can tweak it to draw in a more subtle way if you like. For example, you could make your own image and use it as the slider's thumb. This is actually a UISlider subclass lying on top of a

Change iPhone UISlider bar image

╄→尐↘猪︶ㄣ 提交于 2019-11-26 22:10:36
I'm using a UISlider in my app but I'd like to use a custom "look-and-feel" for it. I have changed the thumb to my own image but is there a way to change the bar also? I have a bar image I would like to use but can't see how to do this. I have found how to change the max and min image but not the bar itself. Costique You were right to use -setMinimumTrackImage:forState: and -setMaximumTrackImage:forState: methods. What you missed is that you should provide stretchable UIImage to them, the rest is taken care of automagically: UIImage *sliderLeftTrackImage = [[UIImage imageNamed: @"SliderMin.png

How to enable “tap and slide” in a UISlider?

喜你入骨 提交于 2019-11-26 17:10:01
问题 What I want to get is a UISlider which lets the user not only slide when he starts on its thumbRect , but also when he taps elsewhere. When the user taps on the slider but outside of the thumbRect , the slider should jump to that value and then still keeping up to the user's sliding gesture . What I have tried so far was implementing a subclass of UIGestureRecognizer like in this suggestion. It starts right then when a touch down somewhere outside the thumbRect occurs. The problem is that the

Increment UISlider by 1 in range 1 to 100

馋奶兔 提交于 2019-11-26 17:01:28
问题 I am new to iPhone, How do I have my UISlider go from 1 to 100 in increments of 1 ? slider = [[UISlider alloc] init]; [slider addTarget:self action:@selector(sliderChange:) forControlEvents:UIControlEventValueChanged]; [slider setBackgroundColor:[UIColor clearColor]]; slider.minimumValue = 1; slider.maximumValue = 100; 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