// // WelcomeVC.m // LNManager // // Created by EchoShacolee on 2018/1/12. // Copyright © 2018年 lee. All rights reserved. // #import "WelcomeVC.h" #import "LoginViewController.h" @interface WelcomeVC () { UIPageControl *pageControl; } @end @implementation WelcomeVC - (void)viewDidLoad { [super viewDidLoad]; [self myInit]; } -(void)myInit { NSArray* images = @[@"下载欢迎页1.png",@"下载欢迎页2.png",@"下载欢迎页3.png"]; UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height)]; /**跳到第5页,也会欢迎结束 */ [scroll setContentSize:CGSizeMake(kSize.width* images.count+1, 0)]; [scroll setBounces:NO]; [scroll setShowsHorizontalScrollIndicator:NO]; scroll.delegate = self; scroll.pagingEnabled = YES; [self.view addSubview:scroll]; pageControl = [[UIPageControl alloc]initWithFrame:CGRectMake(0, kSize.height-50, kSize.width, 20)]; pageControl.numberOfPages = scroll.contentSize.width/scroll.frame.size.width; [self.view addSubview:pageControl]; UIImageView* iv; for (int i =0; i 2) { LoginViewController * loginvc = [[LoginViewController alloc]init]; [UIApplication sharedApplication].keyWindow.rootViewController = loginvc; } } - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { pageControl.currentPage = scrollView.contentOffset.x/scrollView.frame.size.width; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end