增加换肤功能

This commit is contained in:
启星
2025-08-14 10:07:49 +08:00
parent f6964c1e89
commit 4f9318d98e
8789 changed files with 978530 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
//
// QXChatTitleView.h
// QXLive
//
// Created by 启星 on 2025/5/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXChatTitleView : UIView
@property (nonatomic,strong)UIImageView *imageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *timeLabel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,40 @@
//
// QXChatTitleView.m
// QXLive
//
// Created by on 2025/5/22.
//
#import "QXChatTitleView.h"
@interface QXChatTitleView()
@end
@implementation QXChatTitleView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.imageView addRoundedCornersWithRadius:20];
self.imageView.frame = CGRectMake(0, 2, 40, 40);
self.imageView.contentMode = UIViewContentModeScaleAspectFill;
[self addSubview:self.imageView];
self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.imageView.right+8, 0, self.width-self.imageView.right-8, 40)];
self.nameLabel.textColor = QXConfig.textColor;
self.nameLabel.font = [UIFont boldSystemFontOfSize:16];
[self addSubview:self.nameLabel];
// self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.imageView.right+8, self.height-18, self.width-self.imageView.right-8, 18)];
// self.timeLabel.textColor = RGB16(0x999999);
// self.timeLabel.font = [UIFont boldSystemFontOfSize:12];
// [self addSubview:self.timeLabel];
}
@end

View File

@@ -0,0 +1,20 @@
//
// QXSystemMessageCell.h
// QXLive
//
// Created by 启星 on 2025/5/29.
//
#import <UIKit/UIKit.h>
#import "QXMessageModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXSystemMessageCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (nonatomic,strong)QXMessageListModel *model;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,41 @@
//
// QXSystemMessageCell.m
// QXLive
//
// Created by on 2025/5/29.
//
#import "QXSystemMessageCell.h"
@implementation QXSystemMessageCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXSystemMessageCell";
QXSystemMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.backgroundColor = [UIColor clearColor];
}
return cell;
}
-(void)setModel:(QXMessageListModel *)model{
_model = model;
self.contentLabel.text = model.content;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createtime.longLongValue]; //,1000 , 1000
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSString*time = [formatter stringFromDate:date];
self.timeLabel.text = time;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="148" id="KGk-i7-Jjw" customClass="QXSystemMessageCell">
<rect key="frame" x="0.0" y="0.0" width="562" height="148"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="562" height="148"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2023-12-12 12:11:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MIX-5g-MUx">
<rect key="frame" x="16" y="12" width="530" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="lvh-sn-WYA"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="shu-yu-A7z">
<rect key="frame" x="16" y="46" width="530" height="102"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="【某某传媒·粉丝狂欢】今晚22点已开启嗨玩三重奏不仅有才艺舞台还有分组pk,粉丝互动环节等你来~" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Dz-5D-uJ0">
<rect key="frame" x="12" y="12" width="506" height="78"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000001788139343" green="0.20000001788139343" blue="0.20000001788139343" alpha="0.84705883260000003" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="9Dz-5D-uJ0" secondAttribute="bottom" constant="12" id="0lw-re-24m"/>
<constraint firstAttribute="trailing" secondItem="9Dz-5D-uJ0" secondAttribute="trailing" constant="12" id="ISs-JP-WEt"/>
<constraint firstItem="9Dz-5D-uJ0" firstAttribute="top" secondItem="shu-yu-A7z" secondAttribute="top" constant="12" id="QU9-6G-OCe"/>
<constraint firstItem="9Dz-5D-uJ0" firstAttribute="leading" secondItem="shu-yu-A7z" secondAttribute="leading" constant="12" id="vHh-6C-vS8"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="shu-yu-A7z" secondAttribute="bottom" id="2IN-81-1Ac"/>
<constraint firstItem="MIX-5g-MUx" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="4jK-WO-xNR"/>
<constraint firstItem="shu-yu-A7z" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="Kiv-8r-Gsi"/>
<constraint firstItem="MIX-5g-MUx" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="YCH-cw-nqu"/>
<constraint firstAttribute="trailing" secondItem="shu-yu-A7z" secondAttribute="trailing" constant="16" id="drn-tj-mDa"/>
<constraint firstItem="shu-yu-A7z" firstAttribute="top" secondItem="MIX-5g-MUx" secondAttribute="bottom" constant="16" id="jlA-gC-7RN"/>
<constraint firstAttribute="trailing" secondItem="MIX-5g-MUx" secondAttribute="trailing" constant="16" id="w1r-bc-Nhs"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="contentLabel" destination="9Dz-5D-uJ0" id="4KF-EN-uk4"/>
<outlet property="timeLabel" destination="MIX-5g-MUx" id="LSQ-4d-csA"/>
</connections>
<point key="canvasLocation" x="85.496183206106863" y="-150.70422535211267"/>
</tableViewCell>
</objects>
</document>

View File

@@ -0,0 +1,22 @@
//
// QXSystemNoticeCell.h
// QXLive
//
// Created by 启星 on 2025/5/28.
//
#import <UIKit/UIKit.h>
#import "QXMessageModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXSystemNoticeCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UIImageView *noticeImageView;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (nonatomic,strong)QXMessageListModel *model;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,42 @@
//
// QXSystemNoticeCell.m
// QXLive
//
// Created by on 2025/5/28.
//
#import "QXSystemNoticeCell.h"
@implementation QXSystemNoticeCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXSystemNoticeCell";
QXSystemNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.backgroundColor = [UIColor clearColor];
}
return cell;
}
-(void)setModel:(QXMessageListModel *)model{
_model = model;
self.contentLabel.text = model.content;
[self.noticeImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createtime.longLongValue]; //,1000 , 1000
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSString*time = [formatter stringFromDate:date];
self.timeLabel.text = time;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end

View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="490" id="KGk-i7-Jjw" customClass="QXSystemNoticeCell">
<rect key="frame" x="0.0" y="0.0" width="657" height="490"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="657" height="490"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2023-12-12 12:11:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FYn-R3-vts">
<rect key="frame" x="16" y="12" width="625" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="Xnd-ev-jJb"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="B9S-Kr-1SM">
<rect key="frame" x="16" y="46" width="625" height="444"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="T2h-ly-Wcd">
<rect key="frame" x="12" y="12.000000000000014" width="601" height="254.33333333333337"/>
<constraints>
<constraint firstAttribute="width" secondItem="T2h-ly-Wcd" secondAttribute="height" multiplier="319:135" id="L1s-Eg-4a5"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="【某某传媒·粉丝狂欢】今晚22点已开启嗨玩三重奏不仅有才艺舞台还有分组pk,粉丝互动环节等你来~" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DlS-cj-NeR">
<rect key="frame" x="12" y="272.33333333333331" width="601" height="112.33333333333331"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000001788139343" green="0.20000001788139343" blue="0.20000001788139343" alpha="0.84705883260000003" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrowRight" translatesAutoresizingMaskIntoConstraints="NO" id="1bn-8x-RrW">
<rect key="frame" x="589" y="409.66666666666669" width="24" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="QNP-Jj-gIc"/>
<constraint firstAttribute="width" constant="24" id="gHh-d9-oRy"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="立即查看" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4qD-6Q-4as">
<rect key="frame" x="11.999999999999996" y="411" width="63.666666666666657" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="An8-m8-mP8"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tjx-Rj-njY">
<rect key="frame" x="12" y="400.66666666666669" width="601" height="1"/>
<color key="backgroundColor" red="0.88627450980392153" green="0.88627450980392153" blue="0.88627450980392153" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="AVX-fg-dPZ"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="4qD-6Q-4as" secondAttribute="bottom" constant="12" id="7ux-5R-DuW"/>
<constraint firstAttribute="trailing" secondItem="1bn-8x-RrW" secondAttribute="trailing" constant="12" id="Eho-kp-dJY"/>
<constraint firstItem="DlS-cj-NeR" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="I1I-0r-9sL"/>
<constraint firstItem="T2h-ly-Wcd" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="LMi-nD-ziv"/>
<constraint firstItem="1bn-8x-RrW" firstAttribute="centerY" secondItem="4qD-6Q-4as" secondAttribute="centerY" id="OeW-E3-xvE"/>
<constraint firstItem="tjx-Rj-njY" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="RGh-g2-XzN"/>
<constraint firstItem="tjx-Rj-njY" firstAttribute="top" secondItem="DlS-cj-NeR" secondAttribute="bottom" constant="16" id="V50-Ri-QYq"/>
<constraint firstItem="1bn-8x-RrW" firstAttribute="top" secondItem="tjx-Rj-njY" secondAttribute="bottom" constant="8" id="X2R-gs-haf"/>
<constraint firstItem="4qD-6Q-4as" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="b8e-Tt-HdU"/>
<constraint firstItem="DlS-cj-NeR" firstAttribute="top" secondItem="T2h-ly-Wcd" secondAttribute="bottom" constant="6" id="dL1-D6-etx"/>
<constraint firstAttribute="trailing" secondItem="tjx-Rj-njY" secondAttribute="trailing" constant="12" id="mvd-FV-2Vq"/>
<constraint firstAttribute="trailing" secondItem="T2h-ly-Wcd" secondAttribute="trailing" constant="12" id="reD-aG-y7V"/>
<constraint firstItem="T2h-ly-Wcd" firstAttribute="top" secondItem="B9S-Kr-1SM" secondAttribute="top" constant="12" id="suC-xz-cqX"/>
<constraint firstAttribute="trailing" secondItem="DlS-cj-NeR" secondAttribute="trailing" constant="12" id="xBl-X7-1JW"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="FYn-R3-vts" secondAttribute="trailing" constant="16" id="NXe-0S-hFI"/>
<constraint firstItem="B9S-Kr-1SM" firstAttribute="top" secondItem="FYn-R3-vts" secondAttribute="bottom" constant="16" id="W0H-1o-dfh"/>
<constraint firstItem="B9S-Kr-1SM" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="Zp9-Up-ZJM"/>
<constraint firstAttribute="trailing" secondItem="B9S-Kr-1SM" secondAttribute="trailing" constant="16" id="poH-gX-YkI"/>
<constraint firstAttribute="bottom" secondItem="B9S-Kr-1SM" secondAttribute="bottom" id="uMg-XM-0G3"/>
<constraint firstItem="FYn-R3-vts" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="xFH-1c-POL"/>
<constraint firstItem="FYn-R3-vts" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="xtS-TG-JHO"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="contentLabel" destination="DlS-cj-NeR" id="9Eh-Lb-mxC"/>
<outlet property="noticeImageView" destination="T2h-ly-Wcd" id="psV-qh-Uf1"/>
<outlet property="timeLabel" destination="FYn-R3-vts" id="b1Y-Ws-8hj"/>
</connections>
<point key="canvasLocation" x="394.6564885496183" y="155.63380281690141"/>
</tableViewCell>
</objects>
<resources>
<image name="arrowRight" width="16" height="16"/>
</resources>
</document>

View File

@@ -0,0 +1,29 @@
//
// QXSystemTopView.h
// QXLive
//
// Created by 启星 on 2025/5/26.
//
#import <UIKit/UIKit.h>
#import "TIMCommonModel.h"
#import "QXMessageModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol QXSystemTopViewDelegate <NSObject>
@optional
/// type 0 官方公告 1系统消息
-(void)didClickNoticeWithType:(NSInteger)type;
@end
@interface QXSystemTopView : UIView
@property (nonatomic,weak)id<QXSystemTopViewDelegate>delegate;
@property (nonatomic,strong) QXMessageModel *model;
@end
@interface QXSystemTopSubView : UIView
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIImageView *iconImageView;
@property (nonatomic,strong)UILabel *subTitleLabel;
@property (nonatomic,strong)TUIUnReadView *unreadView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,131 @@
//
// QXSystemTopView.m
// QXLive
//
// Created by on 2025/5/26.
//
#import "QXSystemTopView.h"
@interface QXSystemTopView()
@property(nonatomic,strong)QXSystemTopSubView *noticeView;
@property(nonatomic,strong)QXSystemTopSubView *systemView;
@property(nonatomic,strong)UIView *bottomView;
@end
@implementation QXSystemTopView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
MJWeakSelf
self.noticeView = [[QXSystemTopSubView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 74)];
self.noticeView.iconImageView.image = [UIImage imageNamed:@"notice_icon"];
self.noticeView.titleLabel.text = QXText(@"官方公告");
[self.noticeView addTapBlock:^(id _Nonnull obj) {
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickNoticeWithType:)]) {
[weakSelf.delegate didClickNoticeWithType:0];
}
}];
[self addSubview:self.noticeView];
self.systemView = [[QXSystemTopSubView alloc] initWithFrame:CGRectMake(0, 74, SCREEN_WIDTH, 74)];
self.systemView.iconImageView.image = [UIImage imageNamed:@"system_icon"];
self.systemView.titleLabel.text = QXText(@"系统消息");
[self addSubview:self.systemView];
[self.systemView addTapBlock:^(id _Nonnull obj) {
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickNoticeWithType:)]) {
[weakSelf.delegate didClickNoticeWithType:1];
}
}];
self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.systemView.bottom, SCREEN_WIDTH, 8)];
// self.bottomView.backgroundColor = RGB16(0xececec);
self.bottomView.backgroundColor = [UIColor clearColor];
[self addSubview:self.bottomView];
}
-(void)setModel:(QXMessageModel *)model{
_model = model;
self.noticeView.subTitleLabel.text = model.announcement_last_message.title;
self.systemView.subTitleLabel.text = model.system_last_message.title;
[self.noticeView.unreadView setNum:model.announcement_read_count.integerValue];
[self.systemView.unreadView setNum:model.system_no_read_count.integerValue];
}
@end
@implementation QXSystemTopSubView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 12, 50, 50)];
[self addSubview:self.iconImageView];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(12);
make.size.mas_equalTo(CGSizeMake(50, 50));
}];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.iconImageView.right+10, self.iconImageView.top, self.width-self.iconImageView.right-10-16, 24)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = RGB16(0x333333);
[self addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconImageView.mas_right).offset(10);
make.top.mas_equalTo(12);
make.height.mas_equalTo(24);
make.right.mas_equalTo(-16);
}];
self.subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.iconImageView.right+10, self.iconImageView.top, self.width-self.iconImageView.right-10-16, 24)];
self.subTitleLabel.font = [UIFont systemFontOfSize:12];
self.subTitleLabel.textColor = RGB16(0x666666);
[self addSubview:self.subTitleLabel];
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.titleLabel);
make.bottom.mas_equalTo(-16);
make.trailing.mas_equalTo(self).mas_offset(- 2*TConversationCell_Margin_Text);
make.height.mas_equalTo(17);
}];
self.unreadView = [[TUIUnReadView alloc] init];
[self.unreadView setNum:0];
[self addSubview:self.unreadView];
[self.unreadView.unReadLabel sizeToFit];
[self.unreadView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(self.mas_trailing).offset(-16);
make.centerY.mas_equalTo(self.subTitleLabel);
make.width.mas_equalTo(kScale375(20));
make.height.mas_equalTo(kScale375(20));
}];
[self.unreadView.unReadLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.unreadView);
make.size.mas_equalTo(self.unreadView.unReadLabel);
}];
self.unreadView.layer.cornerRadius = kScale375(10);
[self.unreadView.layer masksToBounds];
UIView *line = [[UIView alloc] init];
line.backgroundColor = RGB16(0xDBDBDB);
[self addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(-16);
make.height.mas_equalTo(0.5);
make.bottom.equalTo(self);
}];
}
@end