runmad
runmad

Reputation: 14886

UIPageControl tap to "swipe"?

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 paged icons.

Upvotes: 3

Views: 7211

Answers (3)

Werner Altewischer
Werner Altewischer

Reputation: 10474

See my answer here: Is UIPageControl Useless By Itself?

for a reusable class encapsulating the UIPageControl and UIScrollView.

Upvotes: 1

NWCoder
NWCoder

Reputation: 5266

The method you're looking for is:

UIScrollView scrollRectToVisible: animated:

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

Upvotes: 1

Ben Gottlieb
Ben Gottlieb

Reputation: 85542

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.

Upvotes: 8

Related Questions