iOS Novice Guide page implementation, source code.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.