iOS development Uiscrollview making App guide page

Source: Internet
Author: User

Http://jingyan.baidu.com/article/4dc40848a341dfc8d846f152.htmlListen to the Voice
    • |
    • Browse:4606
    • |
    • Updated: 2015-02-10 12:14
    • |
    • Tags: making
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
Step through the master of a buttonBaidu MasterThe fastest Home service, the best quality computer cleaning!

The application app usually has a guide page, which can be used as a guide to guide the user, or it can be presented to the user to understand the function of the app. Guide page making simple, generally only need a set of pictures, and then show the picture group can be. The Display Picture group is commonly used Uiscrollview to display the page, and is controlled by the Uipagecontrol page controller to display the current page. The Uiscrollview and Uipagecontrol collocation will be more perfect to show the function of the Guide page.

Tools/Materials
    • MAC OS X operating system
    • Xcode compiler
Method/Step
  1. 1

    Create Project and view controllers

    1, create a project, a new Uiviewcontroller;

    2, select the project, right-click-new File ... Select "Cocoa Touch Class"-next, give a reasonable name Viewcontroller, then Next complete;

    3, in the APPDELEGATE.M file contains #import "ViewController.h";

    4. Initialize the view controller that created the Viewcontroller and include it with the navigation bar controller. Set it to the root view controller.

  2. 2

    Create Uiscrollview and add proxies

    1. Add Event agent and data source agent in ViewController.h <UITextFieldDelegate>;

    2, in ViewController.h create Uiscrollview, Uipagecontrol;

    3, in VIEWCONTROLLER.M initialization Uiscrollview, Uipagecontrol;

    4, Agent authorization and add to the view;

    5, repair ScrollView offset.

  3. 3

    Setting the properties of a Uiscrollview

    1, set whether there is rubber band effect properties: bounces;

    2, set whether to use the paging property: pagingenabled;

    3, set whether to allow scrolling properties: scrollenabled;

    4, set whether to display the horizontal scroll bar properties: showshorizontalscrollindicator;

    5, set whether to display the vertical scroll bar properties: showsverticalscrollindicator;

    6. Set content Range Properties: Contentsize.

  4. 4

    Add Uiscrollview proxy methods

           1, complete scrolling: scrollviewdidscroll

          2, going to start dragging: scrollviewwillbegindragging;

          3, end drag: scrollviewdidenddragging

          4, Scrolling will begin to slow down: scrollviewwillbegindecelerating;

          5, rolling deceleration to stop: scrollviewdidenddecelerating.

          6, scroll to the top: scrollviewshouldscrolltotop;

          7, Scroll to top: scrollviewdidscrolltotop.

  5. 5

    Set pagination scrolling effect

    1. Create an array that initializes the Nsarray to be loaded into each page;

    2. Enable Paging properties: pagingenabled = YES;

    3, for each page to add array data, for loop traversal;

    4, according to Nsarray size set content range: Contentsize;

    5, set the total number of pages Uipagecontrol: numberofpages = [array count];

    6, set Uipagecontrol the current page: CurrentPage.

  6. 6

    Uipagecontrol also follows the change when configuring paging scrolling

    1, Add Uiscrollview Agent method: Scrollviewdidscroll

    2, within the scrollviewdidscroll to achieve the monitoring Contentoffset content offset;

    3, according to Contentoffset calculate which page is currently belong to;

    4. Assign value to Self.pageControl.currentPage.

    END
Code
    • Https://github.com/cjq002/UIScrollView.git

    • The code ultimately runs the effect.

      END
Precautions
    • Currently using Mac OS X version 10.9.5
    • Currently using Xcode version 6.0

iOS development Uiscrollview making App guide page

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.