// // YOUPAILZChatRoomInfoView.m // VQU // // Created by CY on 2021/10/28. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAILZChatRoomInfoView.h" @implementation YOUPAILZChatRoomInfoView - (instancetype)init{ if (self = [super init]) { [self youpaifinitUI]; } return self; } - (void)youpaifinitUI{ UILabel *youpaiptitleL = [[UILabel alloc] init]; youpaiptitleL.font = LCFont(16.0f); youpaiptitleL.textColor = [UIColor whiteColor]; [self addSubview:youpaiptitleL]; self.youpaiptitleL = youpaiptitleL; [youpaiptitleL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.top.offset(5.0f); make.width.lessThanOrEqualTo(102.0f); make.height.offset(20.0f); }]; // JhtHorizontalMarquee *youpaiptitleL = [[JhtHorizontalMarquee alloc] initWithFrame:CGRectMake(14.0f, 5.0f, 62.0f,20.0f) singleScrollDuration:0.0f]; // youpaiptitleL.font = LCFont(16.0f); // youpaiptitleL.textColor = [UIColor whiteColor]; // [self addSubview:youpaiptitleL]; // self.youpaiptitleL = youpaiptitleL; // [youpaiptitleL mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.offset(14.0f); // make.top.offset(5.0f); // make.width.lessThanOrEqualTo(62.0f); // make.height.offset(20.0f); // }]; UIButton *youpaipfollowBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(47.0f, 20.0f) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal]; [youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(47.0f, 20.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:UIControlStateSelected]; [youpaipfollowBtn setTitle:@"关注" forState:UIControlStateNormal]; [youpaipfollowBtn setTitle:@"已关注" forState:UIControlStateSelected]; [youpaipfollowBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [youpaipfollowBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected]; youpaipfollowBtn.titleLabel.font = LCFont(12.0f); youpaipfollowBtn.layer.cornerRadius = 10.0f; youpaipfollowBtn.clipsToBounds = YES; [youpaipfollowBtn addTarget:self action:@selector(youpaiffollowBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:youpaipfollowBtn]; self.youpaipfollowBtn = youpaipfollowBtn; [youpaipfollowBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaiptitleL.mas_right).offset(5.0f); make.centerY.equalTo(youpaiptitleL); make.size.mas_offset(CGSizeMake(47.0f, 20.0f)); }]; UIImageView *hotValueImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_chatroom_hot"]]; [self addSubview:hotValueImgV]; [hotValueImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.top.equalTo(youpaiptitleL.mas_bottom).offset(2.0f); make.size.mas_offset(CGSizeMake(14.0f, 14.0f)); }]; UILabel *youpaiphotValueL = [[UILabel alloc] init]; youpaiphotValueL.font = LCFont(12.0f); youpaiphotValueL.textColor = [[UIColor whiteColor] colorWithAlphaComponent:0.6f]; [self addSubview:youpaiphotValueL]; self.youpaiphotValueL = youpaiphotValueL; [youpaiphotValueL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(hotValueImgV.mas_right).offset(3.0f); make.centerY.equalTo(hotValueImgV); }]; UILabel *youpaipchatroomIDL = [[UILabel alloc] init]; youpaipchatroomIDL.font = LCFont(12.0f); youpaipchatroomIDL.textColor = [[UIColor whiteColor] colorWithAlphaComponent:0.6f]; youpaipchatroomIDL.textAlignment = NSTextAlignmentLeft; [self addSubview:youpaipchatroomIDL]; self.youpaipchatroomIDL = youpaipchatroomIDL; [youpaipchatroomIDL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaiphotValueL.mas_right).offset(5.0f); make.centerY.equalTo(hotValueImgV); make.right.offset(0.0f); }]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; [btn addTarget:self action:@selector(youpaifchatroomIDCopyClick) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:btn]; [btn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaipchatroomIDL.mas_left); make.right.equalTo(youpaipchatroomIDL.mas_right); make.top.equalTo(youpaipchatroomIDL.mas_top); make.right.equalTo(youpaipchatroomIDL.mas_right); }]; } - (void)youpaiffollowBtnClick:(UIButton *)sender{ sender.selected = !sender.selected; if (self.youpaiffollowBtnClickBlock != nil) { self.youpaiffollowBtnClickBlock(sender.selected); } } - (void)youpaifchatroomIDCopyClick{ UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.string = [self.youpaipchatroomIDL.text substringWithRange:NSMakeRange(4, self.youpaipchatroomIDL.text.length - 4)]; [ZCHUDHelper showTitle:@"复制成功"]; } @end