IOS development-UIPageControl for paging image carousel

Source: Internet
Author: User

IOS development-UIPageControl for paging image carousel
Paging-related attributes

As long as the pageEnabled attribute of UIScrollView is set to YES, UIScrollView is divided into multiple independent pages, and the content in it can be displayed by page. Generally, the pageEnabled attribute is used with UIPageControl to enhance the paging effect, UIPageControl common attributes include the following: Total number of pages @ property (nonatomic) NSInteger numberOfPages; currently displayed page number @ property (nonatomic) NSInteger currentPage; only one page is displayed, whether to hide the page number indicator @ property (nonatomic) BOOL hidesForSinglePage; color of other page number indicators @ property (nonatomic, retain) UIColor * pageIndicatorTintColor; color of the current page number indicator @ property (nonatomic, retain) UIColor * currentPageIndicatorTintColor;
Paging image carousel instance
# Define ImageCount 5 # import "ViewController. h" @ interface ViewController ()
  
   
@ Property (weak, nonatomic) IBOutlet UIScrollView * scrollView; @ property (weak, nonatomic) IBOutlet UIPageControl * pageControl;/*** timer */@ property (nonatomic, strong) NSTimer * timer; @ end @ implementation ViewController-(void) viewDidLoad {[super viewDidLoad]; // 0. some fixed size parameters CGFloat imageW = self. scrollView. frame. size. width; CGFloat imageH = self. scrollView. frame. size. height; CGFloat imageY = 0; // 1. add imageCount images to scrollView for (int I = 0; I
   
  
Storyboard

Related Article

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.