fix 首页

This commit is contained in:
lianxiang
2018-09-13 23:42:18 +08:00
parent 7d0027f58d
commit fada68d22d
62 changed files with 860 additions and 158 deletions
@@ -36,6 +36,8 @@
@property(nonatomic,strong)MaskViewBootomWaringView *waringView;
@property(nonatomic,strong) UIImageView *maskImageView;
@property(nonatomic,strong) UIImageView *faceView;
@property (nonatomic,strong) UIImageView *hairImageView;
@property(nonatomic) CGPoint attachPoint;
@property(nonatomic,strong) MaskTimeCircularProgressView *cicleProgressView;
@property(nonatomic,strong) UIImageView *swipeGaurdimagView;
@@ -53,7 +55,7 @@
_maskImageView = [[UIImageView alloc] init];
_maskImageView.userInteractionEnabled = YES;
//_maskImageView.backgroundColor = [UIColor purpleColor];
_maskImageView.image = [UIImage imageNamed:@"img_mask"];
_maskImageView.image = [UIImage imageNamed:@"mask_img_mask"];
UISwipeGestureRecognizer * upSwipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(maskupSwipeGesture)];
[upSwipeGesture setDirection:(UISwipeGestureRecognizerDirectionUp)];
@@ -65,6 +67,17 @@
}
return _maskImageView;
}
//头发
- (UIImageView *)hairImageView{
if (!_hairImageView) {
_hairImageView = [[UIImageView alloc] init];
_hairImageView.image = [UIImage imageNamed:@"mask_img_hair"];
}
return _hairImageView;
}
//人脸
- (UIImageView *)faceView{
@@ -72,16 +85,17 @@
_faceView = [[UIImageView alloc] init];
//_faceView.backgroundColor = [UIColor lightGrayColor];
_faceView.userInteractionEnabled = YES;
_faceView.image = [UIImage imageNamed:@"bg_img_face"];
_faceView.image = [UIImage imageNamed:@"mask_img_head"];
}
return _faceView;
}
//倒计时圆环
- (MaskTimeCircularProgressView *)cicleProgressView{
if (!_cicleProgressView) {
_cicleProgressView = [[MaskTimeCircularProgressView alloc] initWithFrame:CGRectMake(100, 500, 136, 136) backColor:GIGARGB(88, 0, 2, 1) progressColor:[UIColor blueColor] lineWidth:10 timeinterval:10];
_cicleProgressView = [[MaskTimeCircularProgressView alloc] initWithFrame:CGRectMake(100, 251, 125, 125) backColor:GIGARGB(88, 0, 2, 1) progressColor:[UIColor blueColor] lineWidth:10 timeinterval:10];
_cicleProgressView.delegate = self;
_cicleProgressView.hidden = YES;
@@ -168,6 +182,7 @@
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.navigationController.navigationBar setTranslucent:NO];
if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
@@ -199,7 +214,7 @@
[self animaMask];
}
#pragma mark - 开始面膜时间动画
#pragma mark - 开始面膜时间动画 合并
-(void)animaMask{
@@ -207,18 +222,51 @@
self.startMaskButton.hidden = YES;
[self.view layoutIfNeeded];
[UIView animateWithDuration:1.0 animations:^{
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.attachPoint.y - 87 + 4);
}];
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.attachPoint.y -124);
make.top.mas_equalTo(self.attachPoint.y -94);
}];
[self.hairImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.attachPoint.y - 94 - 34);
}];
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.attachPoint.y - 87);
}];
[self.maskImageView setImage:[UIImage imageNamed:@"masking_img_mask"]];
[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
// self.cicleProgressView.hidden = NO;
// self.maskImageView.userInteractionEnabled = NO;
//开始面膜时间
//[self startMaskTime];
[self updateMaskingView];
}];
}
#pragma mark 面膜中头像位置
-(void)updateMaskingView{
[self.view layoutIfNeeded];
[UIView animateWithDuration:1.0 animations:^{
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(124 + PhoneX_TopMargin);
}];
[self.hairImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(90 + PhoneX_TopMargin);
}];
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(90 + PhoneX_TopMargin +43);
}];
[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
self.cicleProgressView.hidden = NO;
self.maskImageView.userInteractionEnabled = NO;
//开始面膜时间
[self startMaskTime];
}];
}
@@ -226,21 +274,29 @@
#pragma mark 面膜时间结束复原动画
-(void)endMaskAnimation{
[self.maskImageView setImage:[UIImage imageNamed:@"mask_img_mask"]];
self.cicleProgressView.hidden = YES;
self.swipeGaurdimagView.hidden = NO;
self.startMaskButton.hidden = NO;
[self.view layoutIfNeeded];
[UIView animateWithDuration:1.0 animations:^{
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(124 + PhoneX_TopMargin);
}];
[self.hairImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(90 + PhoneX_TopMargin);
}];
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(254 + PhoneX_TopMargin);
}];
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(91 + PhoneX_TopMargin);
}];
[self.view layoutIfNeeded];
//[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
self.maskImageView.userInteractionEnabled = YES;
@@ -252,28 +308,47 @@
-(void)initUI{
self.view.backgroundColor = GIGA_MAIN_BGCOLOR;
[self.view addSubview:self.maskImageView];
[self.view addSubview:self.faceView];
[self.view bringSubviewToFront:self.maskImageView];
[self.view addSubview:self.maskImageView];
[self.view addSubview:self.hairImageView];
//[self.view bringSubviewToFront:self.maskImageView];
[self.view addSubview:self.swipeGaurdimagView];
[self.view addSubview:self.startMaskButton];
[self.view addSubview:self.startTestButton];
[self.view addSubview:self.cicleProgressView];
//face
[self.faceView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(91 + PhoneX_TopMargin);
make.size.mas_equalTo(CGSizeMake(99, 124));
make.top.mas_equalTo(self.view.mas_top).offset(124 + PhoneX_TopMargin);
make.size.mas_equalTo(CGSizeMake(77, 94));
make.centerX.mas_equalTo(self.view.mas_centerX);
//make.left.mas_equalTo(self.view.mas_left).offset(153);
}];
//hair
[self.hairImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(90 + PhoneX_TopMargin);
make.size.mas_equalTo(CGSizeMake(97, 109));
//make.centerX.mas_equalTo(self.view.mas_centerX);
make.left.mas_equalTo(self.faceView.mas_left).offset(-14);
}];
//mask
[self.maskImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(254 + PhoneX_TopMargin);
make.size.mas_equalTo(CGSizeMake(72, 87));
//make.centerX.mas_equalTo(self.view.mas_centerX);
make.left.mas_equalTo(self.faceView.mas_left);
}];
//circle
[self.cicleProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(251 + PhoneX_TopMargin);
make.size.mas_equalTo(CGSizeMake(125, 125));
make.centerX.mas_equalTo(self.view.mas_centerX);
}];
@@ -292,6 +367,7 @@
make.centerX.mas_equalTo(self.view.mas_centerX);
}];
//startTest
[self.startTestButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(486 + PhoneX_TopMargin);
@@ -415,11 +491,6 @@
GiGaQuestionVC *questionVC = [[GiGaQuestionVC alloc] init];
[self.navigationController pushViewController:questionVC animated:YES];
// }else{
// GiGaUserLoginVC *userlogInVC= [[GiGaUserLoginVC alloc] init];
// GiGaBaseNavViewController *baseNav = [[GiGaBaseNavViewController alloc] initWithRootViewController:userlogInVC];
// [self presentViewController:baseNav animated:YES completion:nil];
// }
}
-(void)addNotify{