123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- //
- // YOUPAIBBVideoResponseView.m
- // VQU
- //
- // Created by Elaine on 2021/10/28.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIBBVideoResponseView.h"
- @implementation YOUPAIBBVideoResponseView
- - (instancetype)initWithModel:(YOUPAILCVideoChatModel*)callModel{
- if (self = [super init]) {
- self.youpaipcallModel = callModel;
- [self youpaifsetupView];
- }
- return self;
- }
- - (void)youpaifsetupView{
- self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
- UIImageView* backImgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
- backImgView.contentMode = UIViewContentModeScaleAspectFill;
- [backImgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipcallModel.youpaipfrom_avatar] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- if (image) {
- backImgView.image = [image applyBlurWithRadius:7.0 tintColor:DecColorFromRGBA(0, 0, 0, 0.2) saturationDeltaFactor:1.5 maskImage:nil];
- }
- }];
- [self addSubview:backImgView];
-
- UIImageView* avatarImgView = [[UIImageView alloc]initWithFrame:CGRectMake((KScreenWidth - 72)/2.0,StatusBarHeight+170,72,72)];
- avatarImgView.contentMode = UIViewContentModeScaleAspectFill;
- avatarImgView.layer.cornerRadius = 36;
- avatarImgView.layer.masksToBounds = YES;
- [avatarImgView sd_setImageWithURL:[[LCTools getImageUrlWithAddress:self.youpaipcallModel.youpaipfrom_avatar] urlWithImageScale:60] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- if (image) {
- avatarImgView.image = image;
- }
- }];
- [self addSubview:avatarImgView];
-
- UILabel* nickLabel = [[UILabel alloc]initWithFrame:CGRectMake(60,CGRectGetMaxY(avatarImgView.frame)+12, KScreenWidth-120,24)];
- nickLabel.text = self.youpaipcallModel.youpaipfrom_nickname;
- nickLabel.textAlignment = NSTextAlignmentCenter;
- nickLabel.textColor = [UIColor whiteColor];
- nickLabel.font = [UIFont systemFontOfSize:21];
- [self addSubview:nickLabel];
-
-
-
- UILabel* label1 = [[UILabel alloc]init];
- label1.textAlignment = NSTextAlignmentCenter;
- label1.textColor = HexColorFromRGB(0xFFFFFF);
- label1.font = [UIFont systemFontOfSize:16];
- label1.backgroundColor = HexColorFromRGBA(0x000000,0.3);
- label1.layer.cornerRadius = 16;
- label1.layer.masksToBounds = YES;
- [self addSubview:label1];
- [label1 makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(nickLabel.bottom).offset(@12);
- make.left.equalTo(self.left).offset(KScreenWidth/2.0-100);
- make.height.equalTo(@32);
- make.width.equalTo(@200);
- }];
- NSString *str1 = @"向你发起 视频聊天";
- NSMutableAttributedString *attributedString1 = [[NSMutableAttributedString alloc] initWithString:str1];
- [attributedString1 addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0xFFBD01) range:[str1 rangeOfString:@"视频聊天"]];
- label1.attributedText = attributedString1;
-
- UIButton* cancelBtn = [[UIButton alloc]init];
- [cancelBtn setTitle:@"挂断" forState:(UIControlStateNormal)];
- [cancelBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
- cancelBtn.titleLabel.font = LCFont(12);
- [cancelBtn setImage:[UIImage imageNamed:@"vqu_images_video_end_baibao"] forState:UIControlStateNormal];
- [cancelBtn addTarget:self action:@selector(youpaifcancelClick) forControlEvents:(UIControlEventTouchUpInside)];
- self.youpaipcancelBtn = cancelBtn;
- [self addSubview:cancelBtn];
- [cancelBtn makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.bottom).offset(@-75);
- make.left.equalTo(self.left).offset(62.5);
- make.height.equalTo(@110);
- make.width.equalTo((KScreenWidth - 62.5*2 -74)/2.0);
- }];
- cancelBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;//使图片和文字水平居中显示
- [cancelBtn setTitleEdgeInsets:UIEdgeInsetsMake(cancelBtn.imageView.frame.size.height +10,-cancelBtn.imageView.frame.size.width, 0.0,0.0)];//文字距离上边框的距离增加imageView的高度,距离左边框减少imageView的宽度,距离下边框和右边框距离不变
- [cancelBtn setImageEdgeInsets:UIEdgeInsetsMake(-30, 0.0,0.0, -cancelBtn.titleLabel.bounds.size.width)];//图片距离右边框距离减少图片的宽度,其它不边
-
- UIButton* confirmBtn = [[UIButton alloc]init];
- [confirmBtn setTitle:@"接听" forState:(UIControlStateNormal)];
- [confirmBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
- confirmBtn.titleLabel.font = LCFont(12);
- [confirmBtn setImage:[UIImage imageNamed:@"vqu_images_video_start_new"] forState:UIControlStateNormal];
- [confirmBtn addTarget:self action:@selector(youpaifconfirmClick) forControlEvents:(UIControlEventTouchUpInside)];
- self.youpaipconfirmBtn = confirmBtn;
- [self addSubview:confirmBtn];
- [confirmBtn makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.bottom).offset(@-75);
- make.left.equalTo(cancelBtn.right).offset(74);
- make.height.equalTo(@110);
- make.width.equalTo((KScreenWidth - 62.5*2 -74)/2.0);
- }];
- confirmBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;//使图片和文字水平居中显示
- [confirmBtn setTitleEdgeInsets:UIEdgeInsetsMake(confirmBtn.imageView.frame.size.height +10,-confirmBtn.imageView.frame.size.width, 0.0,0.0)];//文字距离上边框的距离增加imageView的高度,距离左边框减少imageView的宽度,距离下边框和右边框距离不变
- [confirmBtn setImageEdgeInsets:UIEdgeInsetsMake(-30, 0.0,0.0, -confirmBtn.titleLabel.bounds.size.width)];//图片距离右边框距离减少图片的宽度,其它不边
-
-
- UIButton* btn = [[UIButton alloc]init];
- [btn setImage:[UIImage imageNamed:@"vqu_images_video_revice"] forState:UIControlStateNormal];
- self.youpaipbtn = btn;
- [self addSubview:btn];
- [btn makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.youpaipconfirmBtn.top).offset(@-7.5);
- // make.centerX.equalTo(CGRectGetMinX(confirmBtn.frame)+(KScreenWidth - 62.5*2 -74)/4.0+75);
- make.height.equalTo(35.5);
- make.width.equalTo(149);
- make.left.equalTo(cancelBtn.right).offset(74+((KScreenWidth - 62.5*2 -74)/2.0 - 149)/2.0);
- }];
-
-
- }
- - (void)youpaifconfirmClick{
- if (self.delegate && [self.delegate respondsToSelector:@selector(youpaifconfirmBtnClick)]) {
- [self.delegate youpaifconfirmBtnClick];
- }
- }
- - (void)youpaifcancelClick{
- if (self.delegate && [self.delegate respondsToSelector:@selector(youpaifcancelBtnClick)]) {
- [self.delegate youpaifcancelBtnClick];
- }
- }
- @end
|