// // MyIntroductionViewController.m // Ifish // // Created by imac on 15/11/26. // Copyright © 2015年 imac. All rights reserved. // #import "MyIntroductionViewController.h" #define kGoButtonHeight 60 #define kGoButtonDefaultTitle @"" ///#define kBackColor [UIColor colorWithRed:0 green:157.f/255 blue:232.f/255 alpha:1] #define kGoButtonBackColor [UIColor colorWithRed:0 green:109.f/255 blue:205.f/255 alpha:0.48] #import "AppDelegate.h" #import "RegistViewController.h" static MyIntroductionViewController * introduction = nil; @interface MyIntroductionViewController () { NSArray * _imageNames; NSArray * _titles; NSArray * _contents; NSInteger _page; // void ((^_goActionBlock)(void)); } @property(nonatomic,strong)NSMutableArray * imageViews; @property(nonatomic,strong)UIScrollView * scrollView; @property(nonatomic,strong)UIPageControl * pageControl; @property(nonatomic,strong)UIButton * goButton; @property(nonatomic,strong)UILabel * titleLable; @property(nonatomic,strong)UILabel * contentLable; @property(nonatomic,strong)UIButton*startbutton; @end @implementation MyIntroductionViewController -(instancetype)init{ self = [super init]; if (self) { [self initData]; [self configViews]; } return self; } -(void)initData{ self.introductionStyle = LXIntroductionStyleAllPageGoButton; } -(void)configViews{ self.view.backgroundColor=COLOR_BACK_; [self.view addSubview:self.scrollView]; [self.view addSubview:self.goButton]; } -(void)setPage:(NSInteger)page{ _page = page; [self setUpTitleLabel]; [self setUpContentLabel]; self.pageControl.currentPage = _page; } -(void)setUpTitleLabel{ self.titleLable.text = self.titles[self.page]; } -(void)setHiddenPageControl:(BOOL)hiddenPageControl{ self.pageControl.hidden=hiddenPageControl; } -(void)setIntroductionStyle:(LXIntroductionStyle)introductionStyle{ switch (introductionStyle) { case LXIntroductionStyleAllPageGoButton: { [self.view addSubview:self.goButton]; } break; case LXIntroductionStyleFullScreenGoButton: { UIImageView * imgV = self.imageViews.lastObject; self.goButton.frame = CGRectMake(0, 0, self.scrollView.bounds.size.width, self.scrollView.bounds.size.height); [self.goButton setTitle:@"" forState:UIControlStateNormal]; [imgV addSubview:self.goButton]; self.goButton.backgroundColor=[UIColor clearColor]; } break; case LXIntroductionStyleLastPageGoButton: { UIImageView * imgV = self.imageViews.lastObject; [imgV addSubview:self.goButton]; } break; default: break; } } -(void)setUpScrollView{ CGFloat width = CGRectGetWidth([UIScreen mainScreen].bounds); CGFloat height = CGRectGetHeight([UIScreen mainScreen].bounds); self.scrollView.contentSize = CGSizeMake(width * self.imageNames.count, height); self.scrollView.bounces=NO; //views for (int i=0; i