I have a simple slider and text field below. A text field display the slider's value as the slider is dragged across the slider bar. Is there a way to make the text field to continue displaying value (increasing) once the slider is dragged to the end of the bar but you continue to hold the slider drag it further to the right?
EDIT: I don't want to change the range of slider's value. Maybe a text field displaying slider's value is a bad example. Imagine an image of a ruler just below the slider that expand beyond the frame of the screen. If you drag the slider to a specific measurement on the ruler, lets say the 3 inch mark, the image will stay stationary because the 3 inch mark is visible on screen. But if you the measure to be the 10 inch mark, you continue to drag your slider beyond the slider bar and the ruler image will continue to scroll until you stop dragging at the 10 inch mark.
Hope that's clearer.
- (void)sliderAction {
txtField.text = [NSString stringWithFormat:@"%0.2f", slider.value];
}
slider = [[UISlider alloc] initWithFrame:CGRectMake(30, 100, 260, 30)];
slider.backgroundColor = [UIColor clearColor];
slider.minimumValue = 0.0;
slider.maximumValue = 10.0;
slider.continuous = YES;
slider.value = 0.0;
[slider ad开发者_如何转开发dTarget:self action:@selector(sliderAction) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:slider];
Sounds like you need a wider range of values for your slider - maybe logarithmic?
Is a slider the best control for this view? Sounds like some simple buttons or a custom joypad-type view(capturing gestures) that would suit alot better.
精彩评论