#import"RootViewController.h"@interface Rootviewcontroller () @end @implementation Rootviewcontroller- (void) viewdidload {[Super viewdidload]; /** * Uipagecontrol pagination control, provides the following features: 1. Show the current total number of pages 2. The current page of the display is 3. Toggle the current display of the Pagecontrol to display a different interface*/ //1. Creating a controlUipagecontrol *pagecontrol = [[Uipagecontrol alloc] Initwithframe:cgrectmake ( -, -,260, -)]; //2. Configuration Properties//Pagecontrol.backgroundcolor = [Uicolor Redcolor]; //3. Set the total number of pages displayedPagecontrol.numberofpages =Ten; //4. Set the point colorPagecontrol.pageindicatortintcolor =[Uicolor Redcolor]; //sets the current point color current meaningPagecontrol.currentpageindicatortintcolor =[Uicolor Bluecolor]; //Set the default current pointPagecontrol.currentpage =5; //Add Response Events[Pagecontrol addtarget:self Action: @selector (Handlepagecontrol:) forcontrolevents:uicontroleventvaluechanged ]; //3. Add to Parent View[Self.view Addsubview:pagecontrol]; //4. Release[Pagecontrol release];}- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}#pragmaPoint-(void) Handlepagecontrol: (Uipagecontrol *) pagecontrol{NSLog (@"%ld", pagecontrol.currentpage);}
Paging controls in iOS (Uipagecontrol)