// // 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 whiteColor] colorWithAlphaComponent:0.2]; [self setUpUI]; } return self; } -(void)setUpUI{ UILabel *waringLabel = [[UILabel alloc] init]; waringLabel.text = @"♥️ 亲,请您务必要开启手机声音哦~"; waringLabel.textColor = [UIColor whiteColor]; waringLabel.textAlignment = NSTextAlignmentCenter; waringLabel.font = GIGA_TEXTFONTMEDIUM(14); [self addSubview:waringLabel]; [waringLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.mas_left).offset(10); make.right.mas_equalTo(self.mas_right).offset(-40); 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); }]; } -(void)showView{ [self.dismissBtn initWithBlock:^(UIButton *btn) { [UIView animateWithDuration:0.4 animations:^{ self.frame = CGRectMake(0, KMainH, KMainW, 44); } completion:^(BOOL finished) { [self removeFromSuperview]; }]; } for:UIControlEventTouchUpInside ]; } @end