//
//  GMTestSkinTeachVC.m
//  Gengmei
//
//  Created by 刘鹿杰 on 2019/8/14.
//  Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//

#import "GMTestSkinTeachVC.h"

@interface GMTestSkinTeachVC ()

@end

@implementation GMTestSkinTeachVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"如何测的更准";
    self.navigationBar.backgroundColor = UIColor.whiteColor;
    self.view.backgroundColor = UIColor.whiteColor;
    
    GMScrollView *scrollView = [[GMScrollView alloc] init];
    scrollView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:scrollView];
    
    [scrollView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
        make.top.mas_equalTo(OCNavigationBar.barHeight);
    }];
    
    // 创建containerView
    UIView * container = [[UIView alloc] init];
    [scrollView addSubview:container];
    [container mas_makeConstraints:^(MASConstraintMaker *make){
        make.edges.equalTo(scrollView);
        make.width.equalTo(scrollView);
    }];
    
    // 添加展示图片
    UIImage *image = [UIImage imageNamed:@"face_skin_teachImage"];
    CGFloat imageViewHeight = ((MAINSCREEN_WIDTH - 55) * image.size.height) / image.size.width;
    GMImageView *picImageView = [[GMImageView alloc] initWithImage:image];
    [scrollView addSubview:picImageView];
    [picImageView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(36);
        make.right.mas_equalTo(-35);
        make.height.mas_equalTo(imageViewHeight);
    }];
    
    // 添加按钮View
    UIView *btnBgView = [[GMView alloc] init];
    btnBgView.backgroundColor = UIColor.whiteColor;
    [scrollView addSubview:btnBgView];
    
    [btnBgView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(picImageView.mas_bottom);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(112);
        make.bottom.mas_equalTo(container.mas_bottom);
    }];
    //  设置点击拍照button
    GMButton *startBtn = [[GMButton alloc] init];
    [btnBgView addSubview:startBtn];
    [startBtn mas_updateConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(btnBgView.mas_centerX);
        make.centerY.mas_equalTo(btnBgView.mas_centerY);
        make.width.mas_equalTo(160);
        make.height.mas_equalTo(40);
    }];
    
    UIImage *startBtnImage = [[UIImage imageNamed:@"face_startActicn_btn"] resizableImageWithCapInsets:UIEdgeInsetsMake(20, 80, 20, 80) resizingMode:UIImageResizingModeStretch];
    [startBtn setBackgroundImage:startBtnImage forState:UIControlStateNormal];
    [startBtn setTitle:@"开始拍照" forState:UIControlStateNormal];
    [startBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
    [startBtn.titleLabel setFont:[UIFont systemFontOfSize:14]];
    [startBtn addTarget:self action:@selector(startTestBtnClick) forControlEvents:UIControlEventTouchUpInside];
    // 设置scrollView
    scrollView.contentSize = CGSizeMake(0, imageViewHeight + 148);
}

// 开始检测按钮
- (void)startTestBtnClick {
    [self.navigationController popViewControllerAnimated:YES];
}
@end
