当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - UIPageControl outer dots do not respond when selected (inner dots do)

问题描述:

For my iPad App, I have a main ViewController which contains two UIScrollviews and a UIPageControl. This works well except when I have more than the default three pages in the UIPageControl, in which case I set the number of pages manually in my VC using the call:

[self.pageControl setNumberOfPages:totalPages];

In such a case where the pageControl is set to say 10 pages (i.e. more than the default 3 pages) the dots outside of the 3 middle dots do not respond (i.e. the target action changePage function is not called when a user manually selects any of the dots outside the middle three)

see the picture shown:

Any help on how to resolve this would be most appreciated. Should I try addTarget to the 'changePage' function in code? (currently the target action is set in IB)

Thanks!

网友答案:

I resolved this. The trick was to resize the UIPageControl in IB to the expected width (I did this in IB Size Inspector). I now see the changePage function getting called when I pick even the extreme end dots.

分享给朋友:
您可能感兴趣的文章:
随机阅读: