how can I scroll the view automatically on changing slider value
I want to control sc开发者_开发百科roll bar by slider so when user slides the slider scroll bar should also scroll the view.
Assuming your slider is declared as 'slider' and the scroll view is declared as 'scrollView':
[slider addTarget:self action:@selector(sliderChanged:)
forControlEvents:UIControlEventValueChanged];
Now create a method - (void)sliderChanged:(id)sender
. It should get the slider's value with slider.value
, determine where to scroll your scroll view (a CGRect
that should be visible) to and then [scrollView scrollRectToVisible:animated:]
精彩评论