188 lines
5.8 KiB
Objective-C
188 lines
5.8 KiB
Objective-C
//
|
|
// 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"
|
|
#import "UIView+Toast.h"
|
|
#import "GiGaMeViewController.h"
|
|
#import "GiGaAdDetailViewController.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) ;
|
|
NC_ADD_TARGET_NAME_OBJECT(self, @selector(pushToAppAdDetailView),APP_PUSHTO_DETAILVIEW, nil) ;
|
|
}
|
|
|
|
#pragma mark 广告详情
|
|
-(void)pushToAppAdDetailView{
|
|
|
|
GiGaAdDetailViewController *detailVC=[[GiGaAdDetailViewController alloc] init];
|
|
[self.navigationController pushViewController:detailVC animated:YES];
|
|
|
|
}
|
|
#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);
|
|
NC_REMOVE_NAME(self, APP_PUSHTO_DETAILVIEW, 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{
|
|
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
|
|
if (isUserLogin) {
|
|
GIGA_ShowToast(@"userLogin!");
|
|
|
|
|
|
}else{
|
|
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
|