// // YYRoomSetBiliAlert.m // SweetParty // // Created by bj_szd on 2022/6/9. // #import "YYRoomSetBiliAlert.h" @interface YYRoomSetBiliAlert () @property (nonatomic, assign) NSInteger ratio; @property (weak, nonatomic) IBOutlet UIView *containerView; @end @implementation YYRoomSetBiliAlert - (void)awakeFromNib { [super awakeFromNib]; [self createUI]; } - (void)createUI { [self.confirmBtn setJianBianWithCGSize:CGSizeMake(ScreenWidth-32*2, 45)]; self.containerView.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(APPW-30, 185) direction:FXGradientChangeDirectionVertical startColor:HEXCOLOR(0xD9CDFF) endColor:HEXCOLOR(0xFFFFFF)]; WEAK_SELF [self.touchImgV dg_Tapped:^{ [weakSelf removeFromSuperview]; }]; } - (void)setCurrentRatio:(NSString *)currentRatio { _currentRatio = currentRatio; self.ratio = [currentRatio integerValue]; self.biliLab.text = [NSString stringWithFormat:@"%ld%%", self.ratio]; } - (IBAction)onJian:(id)sender { self.ratio -= 1; if (self.ratio < 0) { self.ratio = 0; } self.biliLab.text = [NSString stringWithFormat:@"%ld%%", self.ratio]; } - (IBAction)onJia:(id)sender { self.ratio += 1; if (self.ratio > 100) { self.ratio = 100; } self.biliLab.text = [NSString stringWithFormat:@"%ld%%", self.ratio]; } - (IBAction)onConfirm:(id)sender { if (self.onCompleteBlock) { self.onCompleteBlock(self.ratio); } [self removeFromSuperview]; } - (IBAction)onCancel:(id)sender { [self removeFromSuperview]; } @end