YOUPAILZChatRoomInfoView.m 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // YOUPAILZChatRoomInfoView.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/10/28.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZChatRoomInfoView.h"
  9. @implementation YOUPAILZChatRoomInfoView
  10. - (instancetype)init{
  11. if (self = [super init]) {
  12. [self youpaifinitUI];
  13. }
  14. return self;
  15. }
  16. - (void)youpaifinitUI{
  17. UILabel *youpaiptitleL = [[UILabel alloc] init];
  18. youpaiptitleL.font = LCFont(16.0f);
  19. youpaiptitleL.textColor = [UIColor whiteColor];
  20. [self addSubview:youpaiptitleL];
  21. self.youpaiptitleL = youpaiptitleL;
  22. [youpaiptitleL mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.left.offset(14.0f);
  24. make.top.offset(5.0f);
  25. make.width.lessThanOrEqualTo(102.0f);
  26. make.height.offset(20.0f);
  27. }];
  28. // JhtHorizontalMarquee *youpaiptitleL = [[JhtHorizontalMarquee alloc] initWithFrame:CGRectMake(14.0f, 5.0f, 62.0f,20.0f) singleScrollDuration:0.0f];
  29. // youpaiptitleL.font = LCFont(16.0f);
  30. // youpaiptitleL.textColor = [UIColor whiteColor];
  31. // [self addSubview:youpaiptitleL];
  32. // self.youpaiptitleL = youpaiptitleL;
  33. // [youpaiptitleL mas_makeConstraints:^(MASConstraintMaker *make) {
  34. // make.left.offset(14.0f);
  35. // make.top.offset(5.0f);
  36. // make.width.lessThanOrEqualTo(62.0f);
  37. // make.height.offset(20.0f);
  38. // }];
  39. UIButton *youpaipfollowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  40. [youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(47.0f, 20.0f) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
  41. [youpaipfollowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(47.0f, 20.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:UIControlStateSelected];
  42. [youpaipfollowBtn setTitle:@"关注" forState:UIControlStateNormal];
  43. [youpaipfollowBtn setTitle:@"已关注" forState:UIControlStateSelected];
  44. [youpaipfollowBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  45. [youpaipfollowBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
  46. youpaipfollowBtn.titleLabel.font = LCFont(12.0f);
  47. youpaipfollowBtn.layer.cornerRadius = 10.0f;
  48. youpaipfollowBtn.clipsToBounds = YES;
  49. [youpaipfollowBtn addTarget:self action:@selector(youpaiffollowBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  50. [self addSubview:youpaipfollowBtn];
  51. self.youpaipfollowBtn = youpaipfollowBtn;
  52. [youpaipfollowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.left.equalTo(youpaiptitleL.mas_right).offset(5.0f);
  54. make.centerY.equalTo(youpaiptitleL);
  55. make.size.mas_offset(CGSizeMake(47.0f, 20.0f));
  56. }];
  57. UIImageView *hotValueImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_chatroom_hot"]];
  58. [self addSubview:hotValueImgV];
  59. [hotValueImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.offset(14.0f);
  61. make.top.equalTo(youpaiptitleL.mas_bottom).offset(2.0f);
  62. make.size.mas_offset(CGSizeMake(14.0f, 14.0f));
  63. }];
  64. UILabel *youpaiphotValueL = [[UILabel alloc] init];
  65. youpaiphotValueL.font = LCFont(12.0f);
  66. youpaiphotValueL.textColor = [[UIColor whiteColor] colorWithAlphaComponent:0.6f];
  67. [self addSubview:youpaiphotValueL];
  68. self.youpaiphotValueL = youpaiphotValueL;
  69. [youpaiphotValueL mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.left.equalTo(hotValueImgV.mas_right).offset(3.0f);
  71. make.centerY.equalTo(hotValueImgV);
  72. }];
  73. UILabel *youpaipchatroomIDL = [[UILabel alloc] init];
  74. youpaipchatroomIDL.font = LCFont(12.0f);
  75. youpaipchatroomIDL.textColor = [[UIColor whiteColor] colorWithAlphaComponent:0.6f];
  76. youpaipchatroomIDL.textAlignment = NSTextAlignmentLeft;
  77. [self addSubview:youpaipchatroomIDL];
  78. self.youpaipchatroomIDL = youpaipchatroomIDL;
  79. [youpaipchatroomIDL mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.equalTo(youpaiphotValueL.mas_right).offset(5.0f);
  81. make.centerY.equalTo(hotValueImgV);
  82. make.right.offset(0.0f);
  83. }];
  84. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  85. [btn addTarget:self action:@selector(youpaifchatroomIDCopyClick) forControlEvents:UIControlEventTouchUpInside];
  86. [self addSubview:btn];
  87. [btn mas_makeConstraints:^(MASConstraintMaker *make) {
  88. make.left.equalTo(youpaipchatroomIDL.mas_left);
  89. make.right.equalTo(youpaipchatroomIDL.mas_right);
  90. make.top.equalTo(youpaipchatroomIDL.mas_top);
  91. make.right.equalTo(youpaipchatroomIDL.mas_right);
  92. }];
  93. }
  94. - (void)youpaiffollowBtnClick:(UIButton *)sender{
  95. sender.selected = !sender.selected;
  96. if (self.youpaiffollowBtnClickBlock != nil) {
  97. self.youpaiffollowBtnClickBlock(sender.selected);
  98. }
  99. }
  100. - (void)youpaifchatroomIDCopyClick{
  101. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  102. pasteboard.string = [self.youpaipchatroomIDL.text substringWithRange:NSMakeRange(4, self.youpaipchatroomIDL.text.length - 4)];
  103. [ZCHUDHelper showTitle:@"复制成功"];
  104. }
  105. @end