UIPageControl继承了UIControl基类,默认属于活动控件,它可以与用户进行交互,经常与UIScrollerView结合使用,在实际项目也是经常使用的。当把UIScrollView的pagingEnabled设置为YES之后,UIScrollView至少每次滚动一页。此时通常结合UIPageControl使用,UIPageControl控件会充当两个功能。
Use Uipagecontrol to show that the current Uiscrollview is showing the page.
Program Uiscrollview automatically scrolls to the appropriate page when the user taps the Uipagecontrol control.
Initialize the images that will be displayed:
Coverlist=[nsarray arraywithobjects:@ "11.png", @ "22.png", @ "33.png", nil];
Get the number of pictures for later use:
Nsuinteger Numberpages=coverlist.count;
To prevent excessive CPU pressure, this takes the form of lazy loading to create the Wxpagecontroller controller, just add some null as placeholders to the array and wait until the Pagecontroller is actually created
Viewcontrollers=[[nsmutablearray Alloc]init];
for (Nsuinteger i=0; i
Page controllers (Uipageviewcontroller) and Uiscrollerview