开发者

UIPageControl tap to "swipe"?

开发者 https://www.devze.com 2022-12-14 12:29 出处:网络
What method to I use to make my UIScrollView update when the sides of a UIPageControl are tapped? When swiping the UIScrollView, the UIPageControl is updated correctly, but if I tap the sides of the U

What method to I use to make my UIScrollView update when the sides of a UIPageControl are tapped? When swiping the UIScrollView, the UIPageControl is updated correctly, but if I tap the sides of the UIPageControl to go to the next page, only the dots update, but the UIScrollView won't swipe. I've looked in the docs and am unable to find any methods for this?

If you're unsure of what I mean, go to your iPhone home screen and tap either side of the white dots, right between the dock and the page开发者_C百科d icons.


Just make sure you're giving your page control enough width, and you've hooked up its Value Changed outlet. If you do this, you should get messages when its value changes; look at the currentPage property on the control. It handles left- and right-margin taps properly.


The method you're looking for is:

UIScrollView scrollRectToVisible: animated:

If you do this on the UIPageControl valueChanged, it should be automatic.


See my answer here: Is UIPageControl Useless By Itself?

for a reusable class encapsulating the UIPageControl and UIScrollView.

0

精彩评论

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