且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

不稳定的UIPageControls

更新时间:2022-11-07 14:01:00

我终于找到了问题:-)

I finally found the problem :-)

为UIPageControl提供的页数值为0的内容在下次更新时将无法正确显示.我正在从数组中读取章节和页码,开始时(假设是本书的封面)没有页面也没有章节可显示,因此我很乐意将它们设置为0.因为我不想更改源数据在我的数组中,我将MAX(pages,1)用于numberOfPages,所以现在它像发条一样工作.

An UIPageControl that is given a value 0 for number of pages will not show correctly the next time it is updated. I was reading chapter and page numbers from an array and in the beginning (let's say cover of the book) there are no pages and no chapters to show, so I happily set these to 0. Since I did not want to change the source data in my array I used MAX(pages , 1) for numberOfPages, so now it's working like clockwork.