GiGaMaskTime/GIGA/Modules/Mask/Controller/UserGuardViewController.m

172 lines
5.1 KiB
Objective-C

//
// UserGuardViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "UserGuardViewController.h"
#import "Masonry.h"
#import "GiGaUserDefault.h"
#import "SHineLabel.h"
@interface UserGuardViewController ()
@property(nonatomic,strong) UIImageView *handimage;
@property(nonatomic,strong) UIImageView *upimage;
@end
@implementation UserGuardViewController
- (void)viewDidLoad {
[super viewDidLoad];
//self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
[self creatUI];
}
-(void)creatUI{
// //face
// UIImageView *faceimage = [[UIImageView alloc] init];
// faceimage.image = [UIImage imageNamed:@"bg_img_face"];
// faceimage.contentMode = UIViewContentModeScaleAspectFit;
// [self.view addSubview:faceimage];
// [faceimage mas_makeConstraints:^(MASConstraintMaker *make) {
//
// make.size.mas_equalTo(CGSizeMake(99, 124));
// make.centerX.mas_equalTo(self.view.mas_centerX);
// make.top.mas_equalTo(self.view.mas_top).offset(91);
//
// }];
//
// //mask
// UIImageView *maskimage = [[UIImageView alloc] init];
// maskimage.image = [UIImage imageNamed:@"mask_img_mask"];
// maskimage.contentMode = UIViewContentModeScaleAspectFit;
// [self.view addSubview:maskimage];
// [maskimage mas_makeConstraints:^(MASConstraintMaker *make) {
// make.size.mas_equalTo(CGSizeMake(72, 87));
// make.centerX.mas_equalTo(self.view.mas_centerX);
// make.top.mas_equalTo(self.view.mas_top).offset(254);
//
// }];
// UIView *holdbackView = [[UIView alloc] initWithFrame:self.view.bounds];
// holdbackView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
// [self.view addSubview:holdbackView];
//usergaurd_uphand
UIImageView *upimage = [[UIImageView alloc] init];
upimage.image = [UIImage imageNamed:@"userguard_up"];
self.upimage = upimage;
[self.view addSubview:upimage];
[upimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.and.with.mas_equalTo(20);
make.centerX.mas_equalTo(self.view.mas_centerX).offset(10);
make.top.mas_equalTo(self.view.mas_top).offset(298);
}];
UIImageView *handimage = [[UIImageView alloc] init];
self.handimage = handimage;
handimage.image = [UIImage imageNamed:@"usergaurd_uphand"];
[self.view addSubview:handimage];
[handimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(upimage.mas_right).offset(2);
make.size.mas_equalTo(CGSizeMake(50, 60));
make.top.mas_equalTo(self.view.mas_top).offset(301);
}];
SHineLabel *shainLabe = [[SHineLabel alloc] init];
[self.view addSubview:shainLabe];
shainLabe.textColor = [UIColor whiteColor];
shainLabe.outLineColor = [UIColor whiteColor];
shainLabe.blurColor = [UIColor whiteColor];
shainLabe.oinsideColor = [UIColor whiteColor];
shainLabe.fontsize = 18;
shainLabe.text = @"按住面膜向上滑\n敷到脸部开始倒计时";
shainLabe.numberOfLines = 0;
[shainLabe mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(222, 60));
//make.width.mas_equalTo(222);
make.top.mas_equalTo(self.view.mas_top).offset(384);
make.centerX.mas_equalTo(self.view.mas_centerX);
}];
// [self creatnaima];
}
- (void)viewDidAppear:(BOOL)animated
{
[self creatnaima];
}
-(void)creatnaima{
[UIView animateWithDuration:1.0 animations:^{
[UIView setAnimationRepeatCount:MAXFLOAT];
[self->_handimage mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(201);
}];
[self->_upimage mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(201);
}];
[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
[self->_handimage mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(301);
}];
[self->_upimage mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(298);
}];
[self.view layoutIfNeeded];
}];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
[self dismisBtnAction];
}
-(void)dismisBtnAction{
[GiGaUserDefault saveUsergaurdflag:YES];
[self dismissViewControllerAnimated:NO completion:^{
NC_POST_NAME_OBJECT(USER_GUARD_DISSMISS, nil);
}];
}
- (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