1/*1. Found in Main.storyboard, ScrollView and Pagecontrol and added to Viewcontroller. 2 2in ScrollView add ImageView, the Novice guide page has several pictures to add several, and then set the image of ImageView, is ready for the picture. 3 3To set the width of the left and view in the Scrollviewscroll view so that it is equal to the size of the picture, and the starting position of the image size, the first one is (0,0), the starting position of the second sheet should be (the width of the screen,0), and so on. 4 4Add Pagecontrol, the starting position of this to be set manually. 5 5. Set Synchronization * /6 //set Uipagecontrol to follow Uiscrollview changes7-(void) Scrollviewdidenddecelerating: (Uiscrollview *) scrollview{8_pc1.currentpage = scrollview.contentoffset.x/424;9 }Ten //to make Uiscrollview follow Uipagecontrol change, you have to listen, to write a method One-(void) Changescrollview: (Uipagecontrol *) Uip1 A { -[_sv1 Setcontentoffset:cgpointmake (424* Uip1.currentpage,0) Animated:yes]; - } the - Source: - - #import "ViewController.h" + - @interfaceViewcontroller () +@property (Weak, nonatomic) Iboutlet Uiscrollview *Sv1; A@property (Weak, nonatomic) Iboutlet Uipagecontrol *PC1; at - @end - - @implementationViewcontroller - -- (void) Viewdidload { in [Super Viewdidload]; - //the size of the content view must be set manually to? _sv1.contentsize = Cgsizemake (424*3,736); + //whether to split page -_sv1.pagingenabled =YES; the //whether to display a horizontal scroll bar when scrolling *_sv1.showshorizontalscrollindicator =NO; $ //whether to display a vertical scroll bar when scrollingPanax Notoginseng_sv1.showsverticalscrollindicator=NO; - //in order to set the Uipagecontrol, the proxy method is used to determine whether to move the_sv1.Delegate=Self ; + //to make Uiscrollview follow Uipagecontrol change, you have to listen, to write a method A [_PC1 addtarget:self Action: @selector (Changescrollview:) forcontrolevents:uicontroleventtouchupinside]; the } + //set Uipagecontrol to follow Uiscrollview changes --(void) Scrollviewdidenddecelerating: (Uiscrollview *) scrollview{ $_pc1.currentpage = scrollview.contentoffset.x/424; $ } - //to make Uiscrollview follow Uipagecontrol change, you have to listen, to write a method --(void) Changescrollview: (Uipagecontrol *) Uip1 the { -[_sv1 Setcontentoffset:cgpointmake (424* Uip1.currentpage,0) Animated:yes];Wuyi } the- (void) didreceivememorywarning { - [Super didreceivememorywarning]; Wu //Dispose of any resources the can be recreated. - } About $ @end
iOS Novice Guide page implementation, source code.