Initial commit

This commit is contained in:
lianxiang
2018-08-22 11:15:52 +08:00
parent d98e20881f
commit 249bf6864e
491 changed files with 68665 additions and 7 deletions
@@ -0,0 +1,13 @@
//
// GiGaAppGaurdVC.h
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaAppGaurdVC : UIViewController
@end
@@ -0,0 +1,71 @@
//
// 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 lightGrayColor];
[GiGaUserDefault saveAppGaurdflag:YES];
[self creatUI];
}
-(void)creatUI{
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(200);
make.height.mas_equalTo(30);
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(self.view.mas_top).offset(200);
}];
dismisBtn.layer.masksToBounds = YES;
dismisBtn.layer.cornerRadius = 15;
}
-(void)dismisBtnAction{
[self dismissViewControllerAnimated:YES completion:^{
NC_POST_NAME_OBJECT(APP_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
@@ -0,0 +1,13 @@
//
// GiGaMaskTaskViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/14.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GiGaMaskTaskViewController : UIViewController
@end
@@ -0,0 +1,170 @@
//
// GiGaMaskTaskViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/14.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaMaskTaskViewController.h"
#import "MaskViewBootomWaringView.h"
#import "GiGaUserLoginVC.h"
#import "UserGuardViewController.h"
#import "GiGaUserDefault.h"
#import "GiGaAppGaurdVC.h"
@interface GiGaMaskTaskViewController ()
@property(nonatomic,strong)MaskViewBootomWaringView *waringView;
@end
@implementation GiGaMaskTaskViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setUpNav];
[self addNotify];
BOOL canshowGaurd = [GiGaUserDefault isShowedGaurd];
if (!canshowGaurd) {
NSLog(@"%d",(int)canshowGaurd );
}
// NSLog(@"%d",(int)canshowGaurd );
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
if (!showAppGaurd) {
[self showAPPappGaurdView];
}
}
-(void)addNotify{
NC_ADD_TARGET_NAME_OBJECT(self, @selector(guardViewDissmiss), USER_GUARD_DISSMISS, nil) ;
NC_ADD_TARGET_NAME_OBJECT(self, @selector(appGauardViewDissmiss),APP_GUARD_DISSMISS, nil) ;
}
#pragma mark 新手引导消失
-(void)guardViewDissmiss{
[self showWaringView];
}
#pragma mark app引导页消失
-(void)appGauardViewDissmiss{
//出现新手引导
BOOL isshowGaurd = [GiGaUserDefault isShowedGaurd];
if (!isshowGaurd) {
NSLog(@"%d",(int)isshowGaurd );
[self showUserGaurdView];
}
}
-(void)dealloc{
NC_REMOVE_NAME(self, USER_GUARD_DISSMISS, nil);
NC_REMOVE_NAME(self, APP_GUARD_DISSMISS, nil);
}
#pragma mark 新手引导
-(void)showUserGaurdView{
UserGuardViewController *userGuardVC = [[UserGuardViewController alloc] init];
if (ISIOS8) {
userGuardVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}else{
userGuardVC.modalPresentationStyle = UIModalPresentationCurrentContext;
}
userGuardVC.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
[self presentViewController:userGuardVC animated:NO completion:nil];
}
#pragma mark App引导页
-(void)showAPPappGaurdView{
GiGaAppGaurdVC *gaurdVC = [[GiGaAppGaurdVC alloc] init];
[self presentViewController:gaurdVC animated:YES completion:nil];
}
#pragma mark - setUpNav
-(void)setUpNav{
//leftItem
UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
leftBtn.frame = CGRectMake(0, 0, 40, 40);
leftBtn.backgroundColor = [UIColor redColor];
[leftBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
[leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
//rightItem
UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
rightBtn.frame = CGRectMake(0, 0, 40, 40);
rightBtn.backgroundColor = [UIColor blueColor];
[rightBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
[rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
}
#pragma mark 消息 action
-(void)leftBtnAction{
GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init];
GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC];
[self presentViewController:baseNav animated:YES completion:nil];
}
#pragma mark 个人中心 action
-(void)rightBtnAction{
}
#pragma mark -bottomView
-(void)showWaringView{
[UIView animateWithDuration:0.4 animations:^{
self.waringView.frame = CGRectMake(0,self.view.frame.size.height - 60, self.view.frame.size.width, 60);
}];
[self.view addSubview:self.waringView];
weakify(self);
[self.waringView.dismissBtn initWithBlock:^(UIButton *btn) {
NSLog(@"GIGAdismissBtn");
[UIView animateWithDuration:0.4 animations:^{
weakSelf.waringView.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.height, 60);
} completion:^(BOOL finished) {
[weakSelf.waringView removeFromSuperview];
}];
} for:UIControlEventTouchUpInside ];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
[self showWaringView];
}
- (MaskViewBootomWaringView *)waringView{
if (!_waringView) {
self.waringView = [[MaskViewBootomWaringView alloc] initWithFrame: CGRectMake(0, self.view.frame.size.height, self.view.frame.size.height, 60)];
}
return _waringView;
}
- (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
@@ -0,0 +1,14 @@
//
// UserGuardViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/21.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UserGuardViewController : UIViewController
@end
@@ -0,0 +1,70 @@
//
// 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"
@interface UserGuardViewController ()
@end
@implementation UserGuardViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//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);
}];
}
-(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
@@ -0,0 +1,15 @@
//
// MaskViewBootomWaringView.h
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GiGaBlockButton.h"
@interface MaskViewBootomWaringView : UIView
@property(nonatomic,strong) GiGaBlockButton *dismissBtn;
@end
@@ -0,0 +1,65 @@
//
// MaskViewBootomWaringView.m
// GIGA
//
// Created by lianxiang on 2018/8/20.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "MaskViewBootomWaringView.h"
#import "Masonry.h"
@implementation MaskViewBootomWaringView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.8];
[self setUpUI];
}
return self;
}
-(void)setUpUI{
UIImageView *iconImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
iconImg.backgroundColor = [UIColor redColor];
[self addSubview:iconImg];
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.and.height.mas_equalTo(40);
make.left.mas_equalTo(10);
make.centerY.mas_equalTo(self.mas_centerY);
}];
UILabel *waringLabel = [[UILabel alloc] init];
waringLabel.text = @"亲爱滴,请您务必要开启手机声音哦";
waringLabel.textColor = [UIColor whiteColor];
waringLabel.textAlignment = NSTextAlignmentCenter;
waringLabel.font = [UIFont systemFontOfSize:16];
[waringLabel sizeToFit];
[self addSubview:waringLabel];
[waringLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(iconImg.mas_right).offset(10);
make.centerY.mas_equalTo(self.mas_centerY);
}];
GiGaBlockButton *dismisBtn = [GiGaBlockButton buttonWithType:UIButtonTypeCustom];
[dismisBtn setImage:[UIImage imageNamed:@"maske_dismiss_waring"] forState:UIControlStateNormal];
[dismisBtn setContentMode:UIViewContentModeScaleAspectFill];
self.dismissBtn = dismisBtn;
[self addSubview:dismisBtn];
[dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.mas_right).offset(10);
make.centerY.mas_equalTo(self.mas_centerY);
make.width.and.height.mas_equalTo(40);
}];
}
@end