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

144 lines
4.2 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;
@end
@implementation UserGuardViewController
- (void)viewDidLoad {
[super viewDidLoad];
//self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
[self creatUI];
}
-(void)creatUI{
// UIButton *dismisBtn= [UIButton buttonWithType:UIButtonTypeCustom];
//
// [dismisBtn setTitle:@"知道了" forState:UIControlStateNormal];
// [dismisBtn setTintColor:[UIColor whiteColor]];
// dismisBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
// [dismisBtn addTarget:self action:@selector(dismisBtnAction) forControlEvents:UIControlEventTouchUpInside];
// [self.view addSubview:dismisBtn];
//
// [dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.width.mas_equalTo(100);
// make.height.mas_equalTo(60);
// make.centerX.mas_equalTo(self.view.mas_centerX);
// make.top.mas_equalTo(self.view.mas_top).offset(200);
// }];
//usergaurd_uphand
UIImageView *upimage = [[UIImageView alloc] init];
upimage.image = [UIImage imageNamed:@"userguard_up"];
[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.view layoutIfNeeded];
} completion:^(BOOL finished) {
[self->_handimage mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(301);
}];
[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