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

122 lines
3.6 KiB
Objective-C

//
// GiGaAppGaurdVC.m
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaAppGaurdVC.h"
#import "Masonry.h"
#import "GiGaUserDefault.h"
@interface GiGaAppGaurdVC ()
@end
@implementation GiGaAppGaurdVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor blueColor];
[GiGaUserDefault saveAppGaurdflag:YES];
[self creatUI];
}
-(void)creatUI{
UIImageView *backimage = [[UIImageView alloc] init];
backimage.image = [UIImage imageNamed:@"appgaurd_bg"];
backimage.frame = CGRectMake(0, 0, KMainW, KMainH);
//backimage.contentMode = UIViewContentModeScaleToFill;
[self.view addSubview:backimage];
[backimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top);
make.bottom.mas_equalTo(self.view.mas_bottom);
make.left.mas_equalTo(self.view.mas_left);
make.right.mas_equalTo(self.view.mas_right);
}];
UIImageView *girlimage = [[UIImageView alloc] init];
girlimage.image = [UIImage imageNamed:@"appgaurd_woman"];
[self.view addSubview:girlimage];
girlimage.contentMode = UIViewContentModeScaleAspectFit;
[girlimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(104 + PhoneX_TopMargin);
make.centerX.mas_equalTo(self.view.mas_centerX);
}];
UIImageView *moonimage = [[UIImageView alloc] init];
moonimage.image = [UIImage imageNamed:@"appgaurd_moon"];
[self.view addSubview:moonimage];
[moonimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(13 + PhoneX_TopMargin);
make.right.mas_equalTo(self.view.mas_right).offset(-5.5);
}];
UIButton *dismisBtn= [UIButton buttonWithType:UIButtonTypeCustom];
[dismisBtn setTitle:@"立即体验" forState:UIControlStateNormal];
//dismisBtn.backgroundColor = [UIColor greenColor];
[dismisBtn addTarget:self action:@selector(dismisBtnAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:dismisBtn];
[dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(160);
make.height.mas_equalTo(40);
make.centerX.mas_equalTo(self.view.mas_centerX);
make.bottom.mas_equalTo(self.view.mas_bottom).offset(-100);
make.top.mas_greaterThanOrEqualTo(girlimage.mas_bottom).offset(20);
}];
dismisBtn.layer.masksToBounds = YES;
dismisBtn.layer.cornerRadius = 20;
dismisBtn.layer.borderWidth = 1;
dismisBtn.layer.borderColor = [UIColor whiteColor].CGColor;
UIView *botomlineView = [[UIView alloc] init];
botomlineView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:botomlineView];
[botomlineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1));
make.bottom.mas_equalTo(self.view.mas_bottom).offset(-10 - PhoneX_BottomMargin);
make.centerX.mas_equalTo(self.view.mas_centerX);
}];
}
-(void)dismisBtnAction{
[self dismissViewControllerAnimated:YES completion:^{
NC_POST_NAME_OBJECT(APP_GUARD_DISSMISS, nil);
}];
}
-(BOOL)prefersStatusBarHidden
{
return YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end