login 适配 se 5s 新增icon 主页修改
This commit is contained in:
@@ -25,42 +25,61 @@
|
||||
#import "GiGaMeViewController.h"
|
||||
#import "GiGaFlyingCommitInputView.h"
|
||||
#import "GiGaFlingCommitVC.h"
|
||||
@interface GiGaMaskTaskViewController ()<UITextFieldDelegate>
|
||||
#import "MaskTimeCircularProgressView.h"
|
||||
#import "UINavigationBar+Custom.h"
|
||||
|
||||
@interface GiGaMaskTaskViewController ()<MaskCirCularProGressViewDelegate>
|
||||
{
|
||||
AVAudioPlayer *_musicPalyer;
|
||||
}
|
||||
|
||||
@property(nonatomic,strong)MaskViewBootomWaringView *waringView;
|
||||
@property(nonatomic,strong)UILabel *countLabel;
|
||||
@property (strong ,nonatomic) LXCountTimer *timer;
|
||||
@property(nonatomic,strong)UILabel *descLabl;
|
||||
@property(nonatomic,strong)UIView *descBackView;
|
||||
//@property (nonatomic,strong) GiGaFlyingCommitInputView *commitInputView;
|
||||
@property(nonatomic,strong) UIImageView *maskImageView;
|
||||
@property(nonatomic,strong) UIImageView *faceView;
|
||||
//@property(nonatomic,strong) UIDynamicAnimator *animator;
|
||||
//@property(nonatomic,strong) UIAttachmentBehavior *attachmentBehavior;
|
||||
@property(nonatomic) CGPoint attachPoint;
|
||||
//@property(nonatomic) UISnapBehavior *snapBehavior;
|
||||
@property(nonatomic,strong) MaskTimeCircularProgressView *cicleProgressView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation GiGaMaskTaskViewController
|
||||
|
||||
//倒计时label
|
||||
-(UILabel *)countLabel{
|
||||
if (!_countLabel) {
|
||||
_countLabel = [[UILabel alloc] init];
|
||||
_countLabel.textColor = [UIColor redColor];
|
||||
_countLabel.text = @"00:00";
|
||||
_countLabel.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
//提示label
|
||||
- (UILabel *)descLabl{
|
||||
if(!_descLabl){
|
||||
_descLabl = [[UILabel alloc] init];
|
||||
_descLabl.text = @"请点击或按住面膜上滑敷到脸部开始倒计时";
|
||||
_descLabl.textAlignment = NSTextAlignmentCenter;
|
||||
_descLabl.numberOfLines = 2;
|
||||
_descLabl.textColor = GIGARGB(89, 216, 197, 1);
|
||||
_descLabl.font = [UIFont fontWithName:GIGA_FONTNAME size:11];
|
||||
}
|
||||
return _countLabel;
|
||||
return _descLabl;
|
||||
}
|
||||
|
||||
- (UIView *)descBackView{
|
||||
|
||||
if(!_descBackView){
|
||||
_descBackView = [[UIView alloc] init];
|
||||
_descBackView.layer.borderWidth = 1;
|
||||
_descBackView.layer.borderColor = GIGARGB(120, 217, 202, 1).CGColor;
|
||||
_descBackView.layer.masksToBounds = YES;
|
||||
_descBackView.layer.cornerRadius = 1;
|
||||
}
|
||||
return _descBackView;
|
||||
}
|
||||
|
||||
//面膜
|
||||
- (UIImageView *)maskImageView{
|
||||
if (!_maskImageView) {
|
||||
_maskImageView = [[UIImageView alloc] init];
|
||||
_maskImageView.userInteractionEnabled = YES;
|
||||
_maskImageView.backgroundColor = [UIColor purpleColor];
|
||||
//_maskImageView.backgroundColor = [UIColor purpleColor];
|
||||
_maskImageView.image = [UIImage imageNamed:@"img_bg"];
|
||||
UIPanGestureRecognizer *pangesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureAction:)];
|
||||
[_maskImageView addGestureRecognizer:pangesture];
|
||||
}
|
||||
@@ -70,12 +89,36 @@
|
||||
- (UIImageView *)faceView{
|
||||
if (!_faceView) {
|
||||
_faceView = [[UIImageView alloc] init];
|
||||
_faceView.backgroundColor = [UIColor lightGrayColor];
|
||||
//_faceView.backgroundColor = [UIColor lightGrayColor];
|
||||
_faceView.userInteractionEnabled = YES;
|
||||
_faceView.image = [UIImage imageNamed:@"img_bg_head"];
|
||||
}
|
||||
return _faceView;
|
||||
}
|
||||
//倒计时圆环
|
||||
- (MaskTimeCircularProgressView *)cicleProgressView{
|
||||
|
||||
if (!_cicleProgressView) {
|
||||
|
||||
_cicleProgressView = [[MaskTimeCircularProgressView alloc] initWithFrame:CGRectMake(100, 500, 136, 136) backColor:GIGARGB(22, 22, 22, 1) progressColor:[UIColor blueColor] lineWidth:10 timeinterval:10];
|
||||
_cicleProgressView.delegate = self;
|
||||
_cicleProgressView.hidden = YES;
|
||||
|
||||
}
|
||||
return _cicleProgressView;
|
||||
}
|
||||
|
||||
//底部提示栏
|
||||
- (MaskViewBootomWaringView *)waringView{
|
||||
|
||||
if (!_waringView) {
|
||||
self.waringView = [[MaskViewBootomWaringView alloc] init];
|
||||
self.waringView.frame = CGRectMake(0,CGRectGetMaxY(self.view.frame), self.view.frame.size.width, 60);
|
||||
}
|
||||
return _waringView;
|
||||
}
|
||||
|
||||
//弹幕
|
||||
-(void)createInputView{
|
||||
|
||||
GiGaFlingCommitVC* GiGaFlingVC = [[GiGaFlingCommitVC alloc] init];
|
||||
@@ -89,32 +132,18 @@
|
||||
|
||||
}
|
||||
|
||||
-(LXCountTimer *)timer{
|
||||
|
||||
if (!_timer) {
|
||||
_timer = [[LXCountTimer alloc] init];
|
||||
}
|
||||
return _timer;
|
||||
}
|
||||
|
||||
//滑动手势
|
||||
-(void)panGestureAction:(UIPanGestureRecognizer *)pan{
|
||||
|
||||
CGPoint panLocation = [pan locationInView:self.view];
|
||||
NSLog(@"panlocation.y:%f",panLocation.y);
|
||||
if (pan.state == UIGestureRecognizerStateBegan) {
|
||||
|
||||
[self animaMask];
|
||||
// self.attachmentBehavior = [[UIAttachmentBehavior alloc] initWithItem:self.faceView attachedToAnchor:self.attachPoint];
|
||||
// [self.animator addBehavior: self.attachmentBehavior ];
|
||||
|
||||
}else if (pan.state == UIGestureRecognizerStateChanged){
|
||||
// [self.snapBehavior setSnapPoint:self.attachPoint];
|
||||
// [self.attachmentBehavior setAnchorPoint:panLocation];
|
||||
|
||||
|
||||
}else if (pan.state == UIGestureRecognizerStateEnded){
|
||||
// [self.animator addBehavior:self.snapBehavior];
|
||||
// [self.animator removeBehavior:self.attachmentBehavior];
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
@@ -123,20 +152,21 @@
|
||||
#pragma mark -开始面膜时间动画
|
||||
-(void)animaMask{
|
||||
|
||||
self.descLabl.hidden = YES;
|
||||
self.descBackView.hidden = YES;
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
[UIView animateWithDuration:1.0 animations:^{
|
||||
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.attachPoint.y - 50);
|
||||
make.top.mas_equalTo(self.attachPoint.y - 118);
|
||||
}];
|
||||
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.attachPoint.y - 50);
|
||||
}];
|
||||
[self.countLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.attachPoint.y + 50 + 10);
|
||||
make.top.mas_equalTo(self.attachPoint.y -174);
|
||||
}];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
} completion:^(BOOL finished) {
|
||||
self.countLabel.hidden = NO;
|
||||
self.cicleProgressView.hidden = NO;
|
||||
self.maskImageView.userInteractionEnabled = NO;
|
||||
//开始面膜时间
|
||||
[self startMaskTime];
|
||||
@@ -146,28 +176,31 @@
|
||||
#pragma mark 面膜时间结束复原动画
|
||||
-(void)endMaskAnimation{
|
||||
|
||||
self.countLabel.hidden = YES;
|
||||
self.cicleProgressView.hidden = YES;
|
||||
self.descLabl.hidden = NO;
|
||||
self.descBackView.hidden = NO;
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
[UIView animateWithDuration:1.0 animations:^{
|
||||
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(100 + 100 + 200);
|
||||
make.top.mas_equalTo(314 + PhoneX_TopMargin);
|
||||
}];
|
||||
|
||||
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(100);
|
||||
make.top.mas_equalTo(103 + PhoneX_TopMargin);
|
||||
}];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
|
||||
} completion:^(BOOL finished) {
|
||||
self.maskImageView.userInteractionEnabled = YES;
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
@@ -181,6 +214,7 @@
|
||||
[self showAPPappGaurdView];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)viewWillDisappear:(BOOL)animated{
|
||||
[super viewWillDisappear:animated];
|
||||
if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
|
||||
@@ -196,84 +230,83 @@
|
||||
[self initUI];
|
||||
[self addNotify];
|
||||
[self creatBackGroundMusic];
|
||||
|
||||
}
|
||||
|
||||
-(void)initUI{
|
||||
|
||||
self.view.backgroundColor = GIGARGB(56, 56, 56, 1);
|
||||
[self.view addSubview:self.maskImageView];
|
||||
[self.view addSubview:self.faceView];
|
||||
[self.view bringSubviewToFront:self.maskImageView];
|
||||
[self.view addSubview:self.countLabel];
|
||||
|
||||
//self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
|
||||
[self.view addSubview:self.descBackView];
|
||||
[self.view addSubview:self.cicleProgressView];
|
||||
|
||||
//face
|
||||
[self.faceView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(100);
|
||||
make.left.mas_equalTo(self.view.mas_centerX).offset(-50);
|
||||
make.size.mas_equalTo(CGSizeMake(100, 100));
|
||||
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(103 + PhoneX_TopMargin);
|
||||
make.left.mas_equalTo(self.view.mas_centerX).offset(-69);
|
||||
make.size.mas_equalTo(CGSizeMake(138, 174));
|
||||
}];
|
||||
|
||||
//mask
|
||||
[self.maskImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(100 + 100 + 200);
|
||||
make.left.mas_equalTo(self.view.mas_centerX).offset(-50);
|
||||
make.size.mas_equalTo(CGSizeMake(100, 100));
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(314 + PhoneX_TopMargin);
|
||||
make.left.mas_equalTo(self.view.mas_centerX).offset(-51);
|
||||
make.size.mas_equalTo(CGSizeMake(102, 118));
|
||||
|
||||
}];
|
||||
|
||||
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(200);
|
||||
make.width.and.height.mas_equalTo(100);
|
||||
//描述
|
||||
|
||||
[self.descBackView mas_makeConstraints:^(MASConstraintMaker *make){
|
||||
make.top.mas_equalTo(500 + PhoneX_TopMargin);
|
||||
make.width.mas_equalTo(149);
|
||||
make.height.mas_equalTo(45);
|
||||
make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
}];
|
||||
self.countLabel.hidden = YES;
|
||||
|
||||
UIButton *testBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[testBtn setTitle:@"测试肤质" forState:UIControlStateNormal];
|
||||
[testBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
testBtn.backgroundColor = [UIColor blueColor];
|
||||
[testBtn addTarget:self action:@selector(testBtnAcion:) forControlEvents:UIControlEventTouchUpInside];
|
||||
testBtn.layer.masksToBounds = YES;
|
||||
testBtn.layer.cornerRadius = 4;
|
||||
|
||||
[self.view addSubview:testBtn];
|
||||
[testBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
make.width.mas_equalTo(150);
|
||||
make.height.mas_equalTo(40);
|
||||
make.bottom.mas_equalTo(self.view.mas_bottom).offset(-130);
|
||||
|
||||
}];
|
||||
|
||||
[self.descBackView addSubview:self.descLabl];
|
||||
|
||||
[self.descLabl mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(121);
|
||||
make.height.mas_equalTo(32);
|
||||
make.center.mas_equalTo(self.descBackView.center);
|
||||
|
||||
}];
|
||||
|
||||
|
||||
// UIButton *testBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
// [testBtn setTitle:@"测试肤质" forState:UIControlStateNormal];
|
||||
// [testBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
// testBtn.backgroundColor = [UIColor blueColor];
|
||||
// [testBtn addTarget:self action:@selector(testBtnAcion:) forControlEvents:UIControlEventTouchUpInside];
|
||||
// testBtn.layer.masksToBounds = YES;
|
||||
// testBtn.layer.cornerRadius = 4;
|
||||
// [self.view addSubview:testBtn];
|
||||
//
|
||||
// [testBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
// make.width.mas_equalTo(150);
|
||||
// make.height.mas_equalTo(40);
|
||||
// make.bottom.mas_equalTo(self.view.mas_bottom).offset(-130);
|
||||
// }];
|
||||
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
CGFloat Y = CGRectGetMinY(self.maskImageView.frame) - 100;
|
||||
CGFloat Y = CGRectGetMaxY(self.faceView.frame) + (CGRectGetMaxY(self.maskImageView.frame) - CGRectGetMaxY(self.faceView.frame)) / 2;
|
||||
CGFloat X = CGRectGetMidX(self.view.frame);
|
||||
// 下巴合并位置
|
||||
CGPoint anchorPoint = CGPointMake(X, Y);
|
||||
self.attachPoint = anchorPoint;
|
||||
// self.snapBehavior = [[UISnapBehavior alloc] initWithItem:self.maskImageView snapToPoint:self.attachPoint];
|
||||
}
|
||||
|
||||
#pragma mark 开始计时
|
||||
|
||||
-(void)countTimeBegain:(NSUInteger)hour minute:(NSUInteger)minute second:(NSUInteger)second{
|
||||
|
||||
long nowTimestamp = [GiGaHelper getNowDateTimestamp];
|
||||
long futrueTimestamp = [GiGaHelper getFutureTimetstamp:hour minute:minute second:second];
|
||||
weakify(self);
|
||||
[self.timer countDownWithStratTimeStamp:nowTimestamp finishTimeStamp:futrueTimestamp completeBlock:^(NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) {
|
||||
[weakSelf refreshTimeCount:hour minute:minute second:second];
|
||||
[self.cicleProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(Y + 68);
|
||||
make.height.and.width.mas_equalTo(136);
|
||||
make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)refreshTimeCount:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second{
|
||||
|
||||
self.countLabel.text = [NSString stringWithFormat:@"%02ld:%02ld",minute,second];
|
||||
if (hour == 0 && minute == 0 && second == 0) {
|
||||
//面膜结束
|
||||
[self maskTimeEnd];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark 面膜时间背景音乐
|
||||
@@ -286,14 +319,14 @@
|
||||
_musicPalyer = player;
|
||||
[[AVAudioSession sharedInstance] setActive:YES error:nil];
|
||||
//设置后台模式和锁屏模式下依然能够播放
|
||||
//[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 开始面膜时间
|
||||
-(void)startMaskTime{
|
||||
|
||||
[self createInputView]; //出现弹幕
|
||||
//[self createInputView]; //出现弹幕
|
||||
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
|
||||
if (delegate.isMasking) {
|
||||
return;
|
||||
@@ -303,17 +336,12 @@
|
||||
[self setBackGroundPlayingInfo];//锁屏音频信息
|
||||
|
||||
//总时间隔 s
|
||||
NSTimeInterval timeInterVal = 61;
|
||||
NSString *timeformat = [GiGaHelper stringWithNSTimerinterval:timeInterVal];
|
||||
NSArray *timesArr = [timeformat componentsSeparatedByString:@":"];
|
||||
NSString *hour = timesArr[0];
|
||||
NSString *min = timesArr[1];
|
||||
NSString *sec = timesArr[2];
|
||||
[self countTimeBegain:hour.integerValue minute:min.integerValue second:sec.integerValue];
|
||||
NSTimeInterval timeInterVal = 10;
|
||||
[self.cicleProgressView startWith:timeInterVal];
|
||||
|
||||
//底部弹窗
|
||||
[self showWaringView];
|
||||
|
||||
return;
|
||||
//app 前台时收到本地通知showAlert 后台时通知提醒
|
||||
[[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"本地推送" fireTimeInterval:timeInterVal alertAction:@"测试面膜时间" withIdentifier:kLOCALNotifiID_MASKETIMEEND];
|
||||
|
||||
@@ -368,7 +396,7 @@
|
||||
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
|
||||
delegate.isMasking = NO;
|
||||
[_musicPalyer stop];
|
||||
[self.timer destoryTimer];
|
||||
|
||||
//复原动画
|
||||
[self endMaskAnimation];
|
||||
}
|
||||
@@ -390,8 +418,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)addNotify{
|
||||
|
||||
NC_ADD_TARGET_NAME_OBJECT(self, @selector(guardViewDissmiss), USER_GUARD_DISSMISS, nil) ;
|
||||
@@ -465,6 +491,8 @@
|
||||
[rightBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
|
||||
[rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
|
||||
|
||||
[self.navigationController.navigationBar cnSetBackgroundColor:GIGARGB(216, 216, 216, 1)];
|
||||
}
|
||||
|
||||
#pragma mark 消息 action
|
||||
@@ -494,29 +522,22 @@
|
||||
#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 ];
|
||||
[UIView animateWithDuration:0.4 animations:^{
|
||||
self.waringView.frame = CGRectMake(0,CGRectGetMaxY(self.view.frame) - 60, self.view.frame.size.width, 60);
|
||||
}];
|
||||
[self.waringView showView];
|
||||
}
|
||||
|
||||
- (MaskViewBootomWaringView *)waringView{
|
||||
#pragma mark - MaskCirCularProGressViewDelegate
|
||||
|
||||
if (!_waringView) {
|
||||
self.waringView = [[MaskViewBootomWaringView alloc] initWithFrame: CGRectMake(0, self.view.frame.size.height, self.view.frame.size.height, 60)];
|
||||
}
|
||||
return _waringView;
|
||||
- (void)updateProgressViewWith:(NSTimeInterval)timeInterval{
|
||||
|
||||
}
|
||||
|
||||
- (void)progressDidFish{
|
||||
NSLog(@"结束");
|
||||
[self maskTimeEnd];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
|
||||
Reference in New Issue
Block a user