fix
This commit is contained in:
@@ -34,64 +34,45 @@
|
||||
}
|
||||
|
||||
@property(nonatomic,strong)MaskViewBootomWaringView *waringView;
|
||||
@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,strong) MaskTimeCircularProgressView *cicleProgressView;
|
||||
@property(nonatomic,strong) UIImageView *swipeGaurdimagView;
|
||||
@property(nonatomic,strong) UIButton *startMaskButton;
|
||||
@property(nonatomic,strong) UIButton *startTestButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation GiGaMaskTaskViewController
|
||||
|
||||
//提示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 _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;
|
||||
}
|
||||
|
||||
#pragma mark - property
|
||||
//面膜
|
||||
- (UIImageView *)maskImageView{
|
||||
if (!_maskImageView) {
|
||||
_maskImageView = [[UIImageView alloc] init];
|
||||
_maskImageView.userInteractionEnabled = YES;
|
||||
//_maskImageView.backgroundColor = [UIColor purpleColor];
|
||||
_maskImageView.image = [UIImage imageNamed:@"img_bg"];
|
||||
UIPanGestureRecognizer *pangesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureAction:)];
|
||||
[_maskImageView addGestureRecognizer:pangesture];
|
||||
_maskImageView.image = [UIImage imageNamed:@"img_mask"];
|
||||
|
||||
UISwipeGestureRecognizer * upSwipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(maskupSwipeGesture)];
|
||||
[upSwipeGesture setDirection:(UISwipeGestureRecognizerDirectionUp)];
|
||||
[_maskImageView addGestureRecognizer:upSwipeGesture];
|
||||
|
||||
UITapGestureRecognizer *tapgesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(maskTapAction)];
|
||||
[_maskImageView addGestureRecognizer:tapgesture];
|
||||
|
||||
}
|
||||
return _maskImageView;
|
||||
}
|
||||
|
||||
//人脸
|
||||
- (UIImageView *)faceView{
|
||||
if (!_faceView) {
|
||||
_faceView = [[UIImageView alloc] init];
|
||||
//_faceView.backgroundColor = [UIColor lightGrayColor];
|
||||
_faceView.userInteractionEnabled = YES;
|
||||
_faceView.image = [UIImage imageNamed:@"img_bg_head"];
|
||||
_faceView.image = [UIImage imageNamed:@"bg_img_face"];
|
||||
}
|
||||
return _faceView;
|
||||
}
|
||||
@@ -107,6 +88,40 @@
|
||||
}
|
||||
return _cicleProgressView;
|
||||
}
|
||||
//⬆️
|
||||
- (UIImageView *)swipeGaurdimagView{
|
||||
if (!_swipeGaurdimagView) {
|
||||
_swipeGaurdimagView = [[UIImageView alloc] init];
|
||||
_swipeGaurdimagView.image = [UIImage imageNamed:@"mask_bg_up"];
|
||||
}
|
||||
return _swipeGaurdimagView;
|
||||
}
|
||||
|
||||
//开始面膜
|
||||
- (UIButton *)startMaskButton{
|
||||
|
||||
if (!_startMaskButton) {
|
||||
_startMaskButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_startMaskButton setBackgroundImage:[UIImage imageNamed:@"btn_start_mask"] forState:UIControlStateNormal];
|
||||
NSAttributedString *title = [GiGaHelper stringWithText:@"开始敷面膜" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTMEDIUM(13) leterSpace:0];
|
||||
[_startMaskButton setAttributedTitle:title forState:UIControlStateNormal];
|
||||
[_startMaskButton addTarget:self action:@selector(startMaskButtonAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
}
|
||||
return _startMaskButton;
|
||||
}
|
||||
|
||||
//开始测试
|
||||
- (UIButton *)startTestButton{
|
||||
if (!_startTestButton) {
|
||||
_startTestButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_startTestButton setBackgroundImage:[UIImage imageNamed:@"btn_start_test"] forState:UIControlStateNormal];
|
||||
NSAttributedString *title = [GiGaHelper stringWithText:@"测试肤质" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(18) leterSpace:0];
|
||||
[_startTestButton setAttributedTitle:title forState:UIControlStateNormal];
|
||||
[_startTestButton addTarget:self action:@selector(testBtnAcion:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _startTestButton;
|
||||
}
|
||||
|
||||
//底部提示栏
|
||||
- (MaskViewBootomWaringView *)waringView{
|
||||
@@ -127,80 +142,14 @@
|
||||
}else{
|
||||
GiGaFlingVC.modalPresentationStyle = UIModalPresentationCurrentContext;
|
||||
}
|
||||
GiGaFlingVC.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
|
||||
GiGaFlingVC.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
|
||||
[self presentViewController:GiGaFlingVC animated:NO completion:nil];
|
||||
|
||||
}
|
||||
|
||||
//滑动手势
|
||||
-(void)panGestureAction:(UIPanGestureRecognizer *)pan{
|
||||
|
||||
CGPoint panLocation = [pan locationInView:self.view];
|
||||
NSLog(@"panlocation.y:%f",panLocation.y);
|
||||
if (pan.state == UIGestureRecognizerStateBegan) {
|
||||
[self animaMask];
|
||||
}else if (pan.state == UIGestureRecognizerStateChanged){
|
||||
|
||||
|
||||
}else if (pan.state == UIGestureRecognizerStateEnded){
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#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 - 118);
|
||||
}];
|
||||
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.attachPoint.y -174);
|
||||
}];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
} completion:^(BOOL finished) {
|
||||
self.cicleProgressView.hidden = NO;
|
||||
self.maskImageView.userInteractionEnabled = NO;
|
||||
//开始面膜时间
|
||||
[self startMaskTime];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark 面膜时间结束复原动画
|
||||
-(void)endMaskAnimation{
|
||||
|
||||
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(314 + PhoneX_TopMargin);
|
||||
}];
|
||||
|
||||
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(103 + PhoneX_TopMargin);
|
||||
}];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
|
||||
} completion:^(BOOL finished) {
|
||||
self.maskImageView.userInteractionEnabled = YES;
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 生命周期
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
}
|
||||
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
@@ -233,49 +182,121 @@
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - 响应事件
|
||||
|
||||
#pragma mark 上滑动手势
|
||||
-(void)maskupSwipeGesture{
|
||||
[self animaMask];
|
||||
}
|
||||
#pragma mark 点击手势
|
||||
-(void)maskTapAction{
|
||||
[self animaMask];
|
||||
}
|
||||
#pragma mark 点击测试按钮
|
||||
-(void)startMaskButtonAction{
|
||||
[self animaMask];
|
||||
}
|
||||
|
||||
#pragma mark - 开始面膜时间动画
|
||||
-(void)animaMask{
|
||||
|
||||
|
||||
self.swipeGaurdimagView.hidden = YES;
|
||||
self.startMaskButton.hidden = YES;
|
||||
self.startTestButton.hidden = YES;
|
||||
[self.view layoutIfNeeded];
|
||||
[UIView animateWithDuration:1.0 animations:^{
|
||||
[self.maskImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.attachPoint.y - 87);
|
||||
}];
|
||||
[self.faceView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.attachPoint.y -124);
|
||||
}];
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
} completion:^(BOOL finished) {
|
||||
self.cicleProgressView.hidden = NO;
|
||||
self.maskImageView.userInteractionEnabled = NO;
|
||||
//开始面膜时间
|
||||
[self startMaskTime];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark 面膜时间结束复原动画
|
||||
-(void)endMaskAnimation{
|
||||
|
||||
self.cicleProgressView.hidden = YES;
|
||||
self.swipeGaurdimagView.hidden = NO;
|
||||
self.startMaskButton.hidden = NO;
|
||||
self.startTestButton.hidden = NO;
|
||||
|
||||
[self.view layoutIfNeeded];
|
||||
[UIView animateWithDuration:1.0 animations:^{
|
||||
[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];
|
||||
|
||||
} completion:^(BOOL finished) {
|
||||
self.maskImageView.userInteractionEnabled = YES;
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark 布局
|
||||
-(void)initUI{
|
||||
|
||||
self.view.backgroundColor = GIGARGB(56, 56, 56, 1);
|
||||
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.descBackView];
|
||||
[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(103 + PhoneX_TopMargin);
|
||||
make.left.mas_equalTo(self.view.mas_centerX).offset(-69);
|
||||
make.size.mas_equalTo(CGSizeMake(138, 174));
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(91 + PhoneX_TopMargin);
|
||||
make.size.mas_equalTo(CGSizeMake(99, 124));
|
||||
make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
}];
|
||||
|
||||
//mask
|
||||
[self.maskImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
||||
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.descBackView mas_makeConstraints:^(MASConstraintMaker *make){
|
||||
make.top.mas_equalTo(500 + PhoneX_TopMargin);
|
||||
make.width.mas_equalTo(149);
|
||||
make.height.mas_equalTo(45);
|
||||
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);
|
||||
|
||||
}];
|
||||
|
||||
[self.descBackView addSubview:self.descLabl];
|
||||
//up
|
||||
[self.swipeGaurdimagView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(368);
|
||||
make.width.and.height.mas_equalTo(20);
|
||||
make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
|
||||
[self.descLabl mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(121);
|
||||
make.height.mas_equalTo(32);
|
||||
make.center.mas_equalTo(self.descBackView.center);
|
||||
}];
|
||||
//startMask
|
||||
[self.startMaskButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.view.mas_top).offset(412);
|
||||
make.size.mas_equalTo(CGSizeMake(117, 25));
|
||||
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);
|
||||
make.size.mas_equalTo(CGSizeMake(132, 41));
|
||||
make.centerX.mas_equalTo(self.view.mas_centerX);
|
||||
}];
|
||||
|
||||
}];
|
||||
|
||||
|
||||
// UIButton *testBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
@@ -403,6 +424,8 @@
|
||||
|
||||
#pragma mark 开始测试
|
||||
-(void)testBtnAcion:(UIButton *)btn{
|
||||
[self createInputView];
|
||||
return;
|
||||
|
||||
BOOL isUserLogin = [GiGaUserDefault isUserLogin];
|
||||
|
||||
@@ -478,17 +501,18 @@
|
||||
#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:@"btn_back"] forState:UIControlStateNormal];
|
||||
[leftBtn addTarget:self action:@selector(leftBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
|
||||
// UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
// leftBtn.frame = CGRectMake(0, 0, 40, 40);
|
||||
// leftBtn.backgroundColor = [UIColor redColor];
|
||||
// [leftBtn setImage:[UIImage imageNamed:@"btn_back"] 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.backgroundColor = [UIColor blueColor];
|
||||
[rightBtn setImage:[UIImage imageNamed:@"nav_circle_avatar"] forState:UIControlStateNormal];
|
||||
[rightBtn addTarget:self action:@selector(rightBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user