开发者

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:]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜