//
//  introduceViewController.m
//  Open
//
//  Created by 看看智能 on 2017/2/28.
//  Copyright © 2017年 黄江涛 . All rights reserved.
//

#import "introduceViewController.h"
#import "SDCycleScrollView.h"
@interface introduceViewController ()<SDCycleScrollViewDelegate>

@end

@implementation introduceViewController









- (void)viewDidLoad {
    [super viewDidLoad];
    self.title =@"社保认证功能介绍";
    self.view.backgroundColor =[UIColor whiteColor];
    //保存图片到本地
    UIImageView *image1 =[[UIImageView alloc]init];
    image1.contentMode = UIViewContentModeScaleToFill;
    image1.image=[UIImage imageNamed:@"socialSecurity-1"];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
    NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms.png"]];   // 保存文件的名称
   [UIImagePNGRepresentation(image1.image)writeToFile: filePath  atomically:YES]; // 保存成功会返回YES
//
//
//    UIImageView *image2 =[[UIImageView alloc]init];
//    image2.image=[UIImage imageNamed:@"socialSecurity-2"];
//    NSString *filePath2 = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms2.png"]];   // 保存文件的名称
//    [UIImagePNGRepresentation(image2.image)writeToFile: filePath2  atomically:YES]; // 保存成功会返回YES
//
//
//    UIImageView *image3 =[[UIImageView alloc]init];
//    image3.image=[UIImage imageNamed:@"socialSecurity-3"];
//    NSString *filePath3 = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms3.png"]];   // 保存文件的名称
//    [UIImagePNGRepresentation(image3.image)writeToFile: filePath3  atomically:YES]; // 保存成功会返回YES
//
//    UIImageView *image4 =[[UIImageView alloc]init];
//    image4.image=[UIImage imageNamed:@"socialSecurity-4"];
//    NSString *filePath4 = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms4.png"]];   // 保存文件的名称
//    [UIImagePNGRepresentation(image4.image)writeToFile: filePath4  atomically:YES];
//
//
//    UIImageView *image5 =[[UIImageView alloc]init];
//    image5.image=[UIImage imageNamed:@"socialSecurity-5"];
//    NSString *filePath5 = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms5.png"]];   // 保存文件的名称
//    [UIImagePNGRepresentation(image5.image)writeToFile: filePath5  atomically:YES];
//
//
//    UIImageView *image6 =[[UIImageView alloc]init];
//    image6.image=[UIImage imageNamed:@"socialSecurity-6"];
//    NSString *filePath6 = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"sms6.png"]];   // 保存文件的名称
//    [UIImagePNGRepresentation(image6.image)writeToFile: filePath6  atomically:YES];
//
//    [SDCycleScrollView cycleScrollViewWithFrame:self.view.frame shouldInfiniteLoop:NO imageNamesGroup:@[image1,image2]];
    UIScrollView *demoContainerView = [[UIScrollView alloc] initWithFrame:self.view.frame];
    demoContainerView.contentSize = CGSizeMake(self.view.frame.size.width,  1977 * WIDTHRADIU);
    [self.view addSubview:demoContainerView];
        NSArray *imagesURLStrings = @[filePath
//                                      ,filePath2,filePath3,filePath4,filePath5,filePath6
                                      ];
    SDCycleScrollView *cycleScrollView2 = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen]bounds].size.width,  1977 * WIDTHRADIU) delegate:self placeholderImage:[UIImage imageNamed:@"placeholder"]];
    cycleScrollView2.backgroundColor =[UIColor whiteColor];
    cycleScrollView2.pageControlStyle =SDCycleScrollViewPageContolStyleAnimated;

    cycleScrollView2.currentPageDotColor = [UIColor clearColor]; // 自定义分页控件小圆标颜色
    [demoContainerView addSubview:cycleScrollView2];
    cycleScrollView2.imageURLStringsGroup=imagesURLStrings;
    cycleScrollView2.autoScroll=NO;
    cycleScrollView2.scrollDirection =UICollectionViewScrollDirectionVertical;
//    demoContainerView.bounces=NO;
    
    cycleScrollView2.infiniteLoop =NO;
//    demoContainerView.scrollEnabled=NO;
    cycleScrollView2.pageControlAliment =SDCycleScrollViewPageContolAlimentCenter;
    cycleScrollView2.pageControlBottomOffset =0;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [SDCycleScrollView clearImagesCache];

}

@end
