增加换肤功能

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,64 @@
//
// QXBlackListCell.h
// QXLive
//
// Created by 启星 on 2025/5/12.
//
#import <UIKit/UIKit.h>
#import "QXLoginModel.h"
#import "QXUserModel.h"
#import "QXRoomModel.h"
typedef NS_ENUM(NSInteger) {
/// 黑名单
QXBlackListCellTypeBlack = 0,
/// 粉丝
QXBlackListCellTypeFans = 1,
/// 关注
QXBlackListCellTypeFocus = 2,
/// 登录
QXBlackListCellTypeLogin,
/// 在线观众
QXBlackListCellTypeOnline,
/// 抱麦
QXBlackListCellTypeHugSeat,
/// 排行榜
QXBlackListCellTypeRank,
/// 访客
QXBlackListCellTypeVisit,
}QXBlackListCellType;
NS_ASSUME_NONNULL_BEGIN
@protocol QXBlackListCellDelegate <NSObject>
@optional
-(void)didRemoveSuccess:(QXUserHomeModel *)userModel;
/// 点击关注
-(void)didFocus:(UIButton*)sender userModel:(QXUserHomeModel *)userModel;
-(void)didClickLoginWithModel:(QXLoginModel*)model;
-(void)didHugSeatWithModel:(QXRoomUserInfoModel*)model;
@end
@interface QXBlackListCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UIButton *removeBtn;
@property (weak, nonatomic)id <QXBlackListCellDelegate> delegate;
@property (assign, nonatomic)QXBlackListCellType cellType;
@property (weak, nonatomic) IBOutlet UIView *iconBgView;
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
@property (nonatomic,strong)QXLoginModel *loginModel;
@property (nonatomic,strong)QXUserHomeModel *userModel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *headerLeftConstraint;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *roleLabel;
@property (nonatomic,strong)QXRoomUserInfoModel *onlineUser;
@property (nonatomic,strong)QXRoomOnlineList *rankModel;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,304 @@
//
// QXBlackListCell.m
// QXLive
//
// Created by on 2025/5/12.
//
#import "QXBlackListCell.h"
@interface QXBlackListCell()
@property (nonatomic,strong)NSMutableArray *iconViewArray;
@end
@implementation QXBlackListCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXBlackListCell";
QXBlackListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.backgroundColor = [UIColor clearColor];
}
return cell;
}
- (IBAction)removeAction:(UIButton*)sender {
switch (self.cellType) {
case QXBlackListCellTypeBlack:{
if (self.delegate && [self.delegate respondsToSelector:@selector(didRemoveSuccess:)]) {
[self.delegate didRemoveSuccess:self.userModel];
}
}
break;
case QXBlackListCellTypeFans:
case QXBlackListCellTypeFocus:{
if (self.delegate && [self.delegate respondsToSelector:@selector(didFocus:userModel:)]) {
[self.delegate didFocus:sender userModel:self.userModel];
}
}
break;
case QXBlackListCellTypeLogin:{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickLoginWithModel:)]) {
[self.delegate didClickLoginWithModel:self.loginModel];
}
}
break;
case QXBlackListCellTypeHugSeat:{
if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithModel:)]) {
[self.delegate didHugSeatWithModel:self.onlineUser];
}
}
break;
default:
break;
}
}
-(void)setLoginModel:(QXLoginModel *)loginModel{
_loginModel = loginModel;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:loginModel.avatar]];
self.nameLabel.text = loginModel.nickname;
if (loginModel.sex.intValue == 1) {
self.sexImageView.image = [UIImage imageNamed:@"user_sex_boy"];
self.sexImageView.hidden = NO;
}else if(loginModel.sex.intValue == 2){
self.sexImageView.image = [UIImage imageNamed:@"user_sex_girl"];
self.sexImageView.hidden = NO;
}else{
self.sexImageView.hidden = YES;
}
}
-(void)setUserModel:(QXUserHomeModel *)userModel{
_userModel = userModel;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:userModel.avatar]];
self.nameLabel.text = userModel.nickname;
if (userModel.sex.intValue == 1) {
self.sexImageView.image = [UIImage imageNamed:@"user_sex_boy"];
self.sexImageView.hidden = NO;
}else if(userModel.sex.intValue == 2){
self.sexImageView.image = [UIImage imageNamed:@"user_sex_girl"];
self.sexImageView.hidden = NO;
}else{
self.sexImageView.hidden = YES;
}
self.removeBtn.selected = userModel.is_follow==1?YES:NO;
if (userModel.icon.count > 0) {
self.iconBgView.hidden = NO;
for (int i = 0;i < self.userModel.icon.count;i++) {
if (i < 3) {
UIImageView *iconImageView = self.iconViewArray[i];
iconImageView.hidden = NO;
[iconImageView sd_setImageWithURL:[NSURL URLWithString:self.userModel.icon[i]]];
}
}
}else{
self.iconBgView.hidden = YES;
}
}
-(void)setOnlineUser:(QXRoomUserInfoModel *)onlineUser{
_onlineUser = onlineUser;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:onlineUser.avatar]];
self.nameLabel.text = onlineUser.nickname;
if (onlineUser.sex.intValue == 1) {
self.sexImageView.image = [UIImage imageNamed:@"user_sex_boy"];
self.sexImageView.hidden = NO;
}else if(onlineUser.sex.intValue == 2){
self.sexImageView.image = [UIImage imageNamed:@"user_sex_girl"];
self.sexImageView.hidden = NO;
}else{
self.sexImageView.hidden = YES;
}
if (onlineUser.role.intValue == 1) {
self.roleLabel.text = QXText(@"房主");
}else if(onlineUser.role.intValue == 2) {
self.roleLabel.text = QXText(@"管理");
}else if(onlineUser.role.intValue == 3) {
self.roleLabel.text = QXText(@"主持");
}else{
self.roleLabel.text = QXText(@"观众");
}
if (onlineUser.pit_number.intValue > 0) {
[self.removeBtn setTitleColor:RGB16(0x666666) forState:(UIControlStateNormal)];
[self.removeBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
self.removeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.removeBtn.backgroundColor = [UIColor clearColor];
[self.removeBtn setTitle:[NSString stringWithFormat:@"%@号麦",onlineUser.pit_number] forState:(UIControlStateNormal)];
if (onlineUser.pit_number.intValue == 10) {
[self.removeBtn setTitle:[NSString stringWithFormat:@"%@麦",QXText(@"嘉宾")] forState:(UIControlStateNormal)];
}
if (onlineUser.pit_number.intValue == 9) {
[self.removeBtn setTitle:[NSString stringWithFormat:@"%@麦",QXText(@"主持")] forState:(UIControlStateNormal)];
}
}else{
if (self.cellType == QXBlackListCellTypeHugSeat) {
[self.removeBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
[self.removeBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
self.removeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.removeBtn.backgroundColor = [UIColor clearColor];
[self.removeBtn setTitle:@"抱麦" forState:(UIControlStateNormal)];
}else{
[self.removeBtn setTitle:@"" forState:(UIControlStateNormal)];
}
}
if (onlineUser.icon.count > 0) {
self.iconBgView.hidden = NO;
for (int i = 0;i < self.onlineUser.icon.count;i++) {
if (i < 3) {
UIImageView *iconImageView = self.iconViewArray[i];
iconImageView.hidden = NO;
[iconImageView sd_setImageWithURL:[NSURL URLWithString:self.onlineUser.icon[i]]];
}
}
}else{
self.iconBgView.hidden = YES;
}
}
-(void)setRankModel:(QXRoomOnlineList *)rankModel{
_rankModel = rankModel;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:rankModel.avatar]];
self.nameLabel.text = rankModel.nickname;
if (rankModel.sex.intValue == 1) {
self.sexImageView.image = [UIImage imageNamed:@"user_sex_boy"];
self.sexImageView.hidden = NO;
}else if(rankModel.sex.intValue == 2){
self.sexImageView.image = [UIImage imageNamed:@"user_sex_girl"];
self.sexImageView.hidden = NO;
}else{
self.sexImageView.hidden = YES;
}
if (rankModel.icon.count > 0) {
self.iconBgView.hidden = NO;
for (int i = 0;i < rankModel.icon.count;i++) {
if (i < 3) {
UIImageView *iconImageView = self.iconViewArray[i];
iconImageView.hidden = NO;
[iconImageView sd_setImageWithURL:[NSURL URLWithString:rankModel.icon[i]]];
}
}
}else{
self.iconBgView.hidden = YES;
}
[self.removeBtn setTitle:[NSString stringWithFormat:@" %@",rankModel.total?rankModel.total:rankModel.gift_prices] forState:(UIControlStateNormal)];
}
-(void)setCellType:(QXBlackListCellType)cellType{
_cellType = cellType;
switch (cellType) {
case QXBlackListCellTypeBlack:{
[self.removeBtn setTitle:QXText(@"移除") forState:(UIControlStateNormal)];
UIImage *norImage = [UIImage imageWithColor:RGB16(0x333333)];
[self.removeBtn setBackgroundImage:norImage forState:(UIControlStateNormal)];
}
break;
case QXBlackListCellTypeFans:{
[self.removeBtn setTitle:QXText(@"回关") forState:(UIControlStateNormal)];
[self.removeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.removeBtn setTitle:QXText(@"已互关") forState:(UIControlStateSelected)];
UIImage *norImage = [UIImage imageWithColor:QXConfig.themeColor];
[self.removeBtn setBackgroundImage:norImage forState:(UIControlStateNormal)];
UIImage *selImage = [UIImage imageWithColor:RGB16(0xEFF2F8)];
[self.removeBtn setBackgroundImage:selImage forState:(UIControlStateSelected)];
}
break;
case QXBlackListCellTypeFocus:{
[self.removeBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)];
[self.removeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.removeBtn setTitle:QXText(@"已关注") forState:(UIControlStateSelected)];
UIImage *norImage = [UIImage imageWithColor:QXConfig.themeColor];
[self.removeBtn setBackgroundImage:norImage forState:(UIControlStateNormal)];
UIImage *selImage = [UIImage imageWithColor:RGB16(0xEFF2F8)];
[self.removeBtn setBackgroundImage:selImage forState:(UIControlStateSelected)];
}
break;
case QXBlackListCellTypeLogin:{
[self.removeBtn setTitle:QXText(@"登录") forState:(UIControlStateNormal)];
UIImage *norImage = [UIImage imageWithColor:QXConfig.themeColor];
[self.removeBtn setBackgroundImage:norImage forState:(UIControlStateNormal)];
}
break;
case QXBlackListCellTypeOnline:{
[self.removeBtn setTitleColor:RGB16(0x666666) forState:(UIControlStateNormal)];
[self.removeBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
self.removeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.removeBtn.backgroundColor = [UIColor clearColor];
self.roleLabel.hidden = NO;
}
break;
case QXBlackListCellTypeHugSeat:{
[self.removeBtn setTitleColor:RGB16(0x666666) forState:(UIControlStateNormal)];
[self.removeBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
self.removeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.removeBtn.backgroundColor = [UIColor clearColor];
self.roleLabel.hidden = NO;
}
break;
case QXBlackListCellTypeRank:{
self.titleLabel.hidden = NO;
self.headerLeftConstraint.constant = 44;
self.nameLabel.textColor = RGB16(0xffffff);
[self.removeBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
[self.removeBtn setBackgroundImage:nil forState:(UIControlStateNormal)];
[self.removeBtn setImage:[UIImage imageNamed:@"room_rank_value_icon"] forState:(UIControlStateNormal)];
[self.removeBtn setTitle:@" 0" forState:(UIControlStateNormal)];
self.removeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
self.removeBtn.backgroundColor = [UIColor clearColor];
}
break;
case QXBlackListCellTypeVisit:{
[self.removeBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)];
[self.removeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.removeBtn setTitle:QXText(@"已关注") forState:(UIControlStateSelected)];
UIImage *norImage = [UIImage imageWithColor:QXConfig.themeColor];
[self.removeBtn setBackgroundImage:norImage forState:(UIControlStateNormal)];
UIImage *selImage = [UIImage imageWithColor:RGB16(0xEFF2F8)];
[self.removeBtn setBackgroundImage:selImage forState:(UIControlStateSelected)];
self.removeBtn.hidden = YES;
}
break;
default:
break;
}
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
CGFloat iconWidth = 38;
CGFloat iconHeight = 16;
CGFloat margin = 6;
for (int i = 0; i < 3; i++) {
UIImageView *iconImageView = [[UIImageView alloc] init];
iconImageView.hidden = YES;
[self.iconBgView addSubview:iconImageView];
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(i*(iconWidth+margin));
make.width.mas_equalTo(iconWidth);
make.height.mas_equalTo(iconHeight);
make.centerY.equalTo(self.iconBgView);
}];
[self.iconViewArray addObject:iconImageView];
}
}
-(NSMutableArray *)iconViewArray{
if (!_iconViewArray) {
_iconViewArray = [NSMutableArray array];
}
return _iconViewArray;
}
- (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,136 @@
<?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="default" indentationWidth="10" rowHeight="124" id="KGk-i7-Jjw" customClass="QXBlackListCell">
<rect key="frame" x="0.0" y="0.0" width="516" height="124"/>
<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="516" height="124"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="2x4-X2-0Ee">
<rect key="frame" x="16" y="37" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="FZO-Db-S0r"/>
<constraint firstAttribute="height" constant="50" id="jg8-Fv-y71"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Eq-O4-ACD">
<rect key="frame" x="76" y="41" width="330" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="9Za-2L-Rv2"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tP4-mF-MDR">
<rect key="frame" x="421" y="46" width="79" height="32"/>
<color key="backgroundColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="KkC-PS-thG"/>
<constraint firstAttribute="width" constant="79" id="pIz-RR-Izs"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="移除">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="16"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="removeAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="ixo-hh-Q00"/>
</connections>
</button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ocy-ib-avk">
<rect key="frame" x="50" y="71" width="16" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="dMe-HM-Ngn"/>
<constraint firstAttribute="width" constant="16" id="wq1-j5-0BI"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9dz-yF-Htz">
<rect key="frame" x="76" y="69" width="329" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="Eck-GR-Ln9"/>
</constraints>
</view>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="03X-4t-Yn8">
<rect key="frame" x="16.000000000000004" y="53.666666666666664" width="35.333333333333343" height="16.999999999999993"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uoV-9s-SrU">
<rect key="frame" x="23.666666666666671" y="78" width="35" height="14"/>
<color key="backgroundColor" red="0.72941176470000002" green="0.38823529410000002" blue="0.86666666670000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="YiI-F2-QB0"/>
<constraint firstAttribute="height" constant="14" id="uIC-LI-i2u"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="7"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<constraints>
<constraint firstItem="uoV-9s-SrU" firstAttribute="centerX" secondItem="2x4-X2-0Ee" secondAttribute="centerX" id="0xO-ho-O06"/>
<constraint firstItem="2x4-X2-0Ee" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="642-Aw-byL"/>
<constraint firstItem="ocy-ib-avk" firstAttribute="bottom" secondItem="2x4-X2-0Ee" secondAttribute="bottom" id="BNP-bY-AF0"/>
<constraint firstItem="uoV-9s-SrU" firstAttribute="bottom" secondItem="2x4-X2-0Ee" secondAttribute="bottom" constant="5" id="F7B-Jc-4Sr"/>
<constraint firstAttribute="trailing" secondItem="tP4-mF-MDR" secondAttribute="trailing" constant="16" id="KBk-DE-jja"/>
<constraint firstItem="9dz-yF-Htz" firstAttribute="top" secondItem="0Eq-O4-ACD" secondAttribute="bottom" constant="4" id="PdK-w4-wyM"/>
<constraint firstItem="tP4-mF-MDR" firstAttribute="leading" secondItem="9dz-yF-Htz" secondAttribute="trailing" constant="16" id="Sgy-cN-hNl"/>
<constraint firstItem="tP4-mF-MDR" firstAttribute="leading" secondItem="0Eq-O4-ACD" secondAttribute="trailing" constant="15" id="a8I-Zz-dzM"/>
<constraint firstItem="ocy-ib-avk" firstAttribute="trailing" secondItem="2x4-X2-0Ee" secondAttribute="trailing" id="cIq-ni-x4p"/>
<constraint firstItem="tP4-mF-MDR" firstAttribute="centerY" secondItem="2x4-X2-0Ee" secondAttribute="centerY" id="foQ-Ke-Z4r"/>
<constraint firstItem="9dz-yF-Htz" firstAttribute="leading" secondItem="0Eq-O4-ACD" secondAttribute="leading" id="jWB-9g-wpJ"/>
<constraint firstItem="0Eq-O4-ACD" firstAttribute="top" secondItem="2x4-X2-0Ee" secondAttribute="top" constant="4" id="kzA-P7-kb3"/>
<constraint firstItem="0Eq-O4-ACD" firstAttribute="leading" secondItem="2x4-X2-0Ee" secondAttribute="trailing" constant="10" id="nsc-L7-KIp"/>
<constraint firstItem="03X-4t-Yn8" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="w49-cW-YZB"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<constraints>
<constraint firstItem="03X-4t-Yn8" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="Qpr-db-ozW"/>
<constraint firstItem="2x4-X2-0Ee" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="e1E-QC-o5D"/>
</constraints>
<connections>
<outlet property="headerImageView" destination="2x4-X2-0Ee" id="djB-Rp-cKT"/>
<outlet property="headerLeftConstraint" destination="642-Aw-byL" id="NK5-lE-nH5"/>
<outlet property="iconBgView" destination="9dz-yF-Htz" id="rCR-5k-TAC"/>
<outlet property="nameLabel" destination="0Eq-O4-ACD" id="3bb-Hb-hp9"/>
<outlet property="removeBtn" destination="tP4-mF-MDR" id="fV5-A9-I8F"/>
<outlet property="roleLabel" destination="uoV-9s-SrU" id="0Mh-FN-gHb"/>
<outlet property="sexImageView" destination="ocy-ib-avk" id="jmO-hM-tLv"/>
<outlet property="titleLabel" destination="03X-4t-Yn8" id="tKl-Qk-CXV"/>
</connections>
<point key="canvasLocation" x="287.02290076335879" y="47.887323943661976"/>
</tableViewCell>
</objects>
</document>

View File

@@ -0,0 +1,19 @@
//
// QXNoticeAnchorCell.h
// QXLive
//
// Created by 启星 on 2025/5/14.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXNoticeAnchorCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *headerImagView;
@property (weak, nonatomic) IBOutlet UIButton *btnSwitch;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,33 @@
//
// QXNoticeAnchorCell.m
// QXLive
//
// Created by on 2025/5/14.
//
#import "QXNoticeAnchorCell.h"
@implementation QXNoticeAnchorCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXNoticeAnchorCell";
QXNoticeAnchorCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
}
return cell;
}
- (IBAction)btnSwitchAction:(UIButton *)sender {
sender.selected = !sender.selected;
}
- (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,78 @@
<?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="default" indentationWidth="10" rowHeight="218" id="KGk-i7-Jjw" customClass="QXNoticeAnchorCell">
<rect key="frame" x="0.0" y="0.0" width="665" height="218"/>
<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="665" height="218"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="A33-lf-bv5">
<rect key="frame" x="609" y="89" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="Mb9-G1-4hI"/>
<constraint firstAttribute="height" constant="40" id="sfr-a5-HD5"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="home_switch_on"/>
<state key="selected" image="home_switch_off"/>
<connections>
<action selector="btnSwitchAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="CLN-b8-5oC"/>
</connections>
</button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kqD-zm-rKh">
<rect key="frame" x="16" y="84" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="Yju-ae-sh1"/>
<constraint firstAttribute="height" constant="50" id="iIe-IH-Mma"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRaiuds">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="如梦幻泡影" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wjO-Nb-dzj">
<rect key="frame" x="76" y="98.666666666666671" width="523" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="wjO-Nb-dzj" firstAttribute="leading" secondItem="kqD-zm-rKh" secondAttribute="trailing" constant="10" id="Bzl-K0-MiK"/>
<constraint firstAttribute="trailing" secondItem="A33-lf-bv5" secondAttribute="trailing" constant="16" id="RUh-nG-aSw"/>
<constraint firstItem="kqD-zm-rKh" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="V89-Eg-OBF"/>
<constraint firstItem="wjO-Nb-dzj" firstAttribute="centerY" secondItem="kqD-zm-rKh" secondAttribute="centerY" id="WOM-Bx-f8F"/>
<constraint firstItem="A33-lf-bv5" firstAttribute="leading" secondItem="wjO-Nb-dzj" secondAttribute="trailing" constant="10" id="cZU-YS-5XN"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<constraints>
<constraint firstItem="A33-lf-bv5" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="Bui-BI-8JV"/>
<constraint firstItem="kqD-zm-rKh" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="NLE-6e-ut5"/>
</constraints>
<connections>
<outlet property="btnSwitch" destination="A33-lf-bv5" id="tLw-p8-g0j"/>
<outlet property="headerImagView" destination="kqD-zm-rKh" id="X1T-k9-ngy"/>
<outlet property="nameLabel" destination="wjO-Nb-dzj" id="xQo-OW-2R1"/>
</connections>
<point key="canvasLocation" x="402.29007633587787" y="80.985915492957744"/>
</tableViewCell>
</objects>
<resources>
<image name="home_switch_off" width="40" height="32"/>
<image name="home_switch_on" width="40" height="32"/>
</resources>
</document>

View File

@@ -0,0 +1,29 @@
//
// QXChirldModeView.h
// QXLive
//
// Created by 启星 on 2025/5/12.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger) {
QXPasswordViewTypeChirldMode = 0,
QXPasswordViewTypeRoom
}QXPasswordViewType;
NS_ASSUME_NONNULL_BEGIN
@protocol QXPasswordViewDelegate <NSObject>
@optional
/// 输入完成回调
-(void)inputFinished:(NSString*)password;
@end
@interface QXPasswordView : UIView
@property (nonatomic,assign) QXPasswordViewType type;
@property (nonatomic,weak)id <QXPasswordViewDelegate> delegate;
-(instancetype)initWithFrame:(CGRect)frame type:(QXPasswordViewType)type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,213 @@
//
// QXChirldModeView.m
// QXLive
//
// Created by on 2025/5/12.
//
#import "QXPasswordView.h"
CGFloat labelWith = 50;
CGFloat labelHeight = 63;
@interface QXPasswordView()<UITextFieldDelegate>
@property(nonatomic,strong)UILabel *titleLabel;
@property(nonatomic,strong)UIButton *forgotBtn;
@property(nonatomic,strong)UITextField *textField;
@property(nonatomic,strong)UILabel *label1;
@property(nonatomic,strong)UILabel *label2;
@property(nonatomic,strong)UILabel *label3;
@property(nonatomic,strong)UILabel *label4;
@end
@implementation QXPasswordView
- (instancetype)initWithFrame:(CGRect)frame type:(QXPasswordViewType)type
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
[self setType:type];
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[self addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(self).offset(30);
make.height.mas_equalTo(24);
}];
self.label1 = [[UILabel alloc] init];
[self setCustomLabel:self.label1];
[self addSubview:self.label1];
self.label2 = [[UILabel alloc] init];
[self setCustomLabel:self.label2];
[self addSubview:self.label2];
self.label3 = [[UILabel alloc] init];
[self setCustomLabel:self.label3];
[self addSubview:self.label3];
self.label4 = [[UILabel alloc] init];
[self setCustomLabel:self.label4];
[self addSubview:self.label4];
[self.label2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.mas_centerX).offset(-8);
make.size.mas_equalTo(CGSizeMake(labelWith, labelHeight));
make.top.equalTo(self.titleLabel.mas_bottom).offset(30);
}];
[self.label3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mas_centerX).offset(8);
make.size.mas_equalTo(CGSizeMake(labelWith, labelHeight));
make.top.equalTo(self.label2);
}];
[self.label1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.label2.mas_left).offset(-16);
make.size.mas_equalTo(CGSizeMake(labelWith, labelHeight));
make.top.equalTo(self.label2);
}];
[self.label4 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.label3.mas_right).offset(16);
make.size.mas_equalTo(CGSizeMake(labelWith, labelHeight));
make.top.equalTo(self.label2);
}];
self.textField = [[UITextField alloc] init];
self.textField.delegate = self;
self.textField.font = [UIFont systemFontOfSize:1];
self.textField.keyboardType = UIKeyboardTypeNumberPad;
self.textField.returnKeyType = UIReturnKeyDone;
self.textField.textColor = [UIColor clearColor];
self.textField.userInteractionEnabled = YES;
// [self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventEditingChanged)];
[self insertSubview:self.textField atIndex:0];
[self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(self.label1);
make.width.height.mas_equalTo(1);
}];
self.forgotBtn = [[UIButton alloc] init];
[self.forgotBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
self.forgotBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.forgotBtn setTitle:[NSString stringWithFormat:@"%@?%@",QXText(@"忘记密码"),QXText(@"请联系客服")] forState:(UIControlStateNormal)];
[self.forgotBtn addTarget:self action:@selector(forgotAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.forgotBtn];
[self.forgotBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.label1.mas_bottom).offset(10);
make.height.mas_equalTo(38);
make.centerX.equalTo(self);
}];
}
-(void)forgotAction{
}
-(void)setCustomLabel:(UILabel*)label{
label.font = [UIFont boldSystemFontOfSize:22];
label.layer.cornerRadius = 5;
label.layer.masksToBounds = YES;
label.textColor = QXConfig.textColor;
label.textAlignment = NSTextAlignmentCenter;
label.backgroundColor = RGB16(0xEFF2F8);
MJWeakSelf
[label addTapBlock:^(id _Nonnull obj) {
[weakSelf.textField becomeFirstResponder];
}];
// label.layer.shadowColor = [UIColor grayColor].CGColor;
// label.layer.shadowOpacity = 0.5;
// label.layer.shadowOffset = CGSizeMake(0, 2);
// label.layer.shadowRadius = 5;
// label.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, labelWith, labelHeight) cornerRadius:0].CGPath;
// [label addShadowWithColor:[UIColor grayColor] radius:5 frame:CGRectMake(0, 0, labelWith, labelHeight)];
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
if (string.length>1) {
//
return NO;
}
if (textField.text.length <= 4) {
if (textField.text.length == 0) {
if ([string isEqualToString:@""]) {
//
}else{
self.label1.text = string;
}
}else if (textField.text.length == 1){
if ([string isEqualToString:@""]) {
self.label1.text = @"";
}else{
self.label2.text = string;
}
}else if (textField.text.length == 2){
if ([string isEqualToString:@""]) {
self.label2.text = @"";
}else{
self.label3.text = string;
}
self.label4.text = @"";
}else if (textField.text.length == 3){
if ([string isEqualToString:@""]) {
self.label3.text = @"";
}else{
self.label4.text = string;
self.textField.text = [NSString stringWithFormat:@"%@%@%@%@",self.label1.text,self.label2.text,self.label3.text,self.label4.text];
[self.textField resignFirstResponder];
if (self.delegate && [self.delegate respondsToSelector:@selector(inputFinished:)]) {
[self.delegate inputFinished:[NSString stringWithFormat:@"%@%@%@%@",self.label1.text,self.label2.text,self.label3.text,self.label4.text]];
}
}
}else{
if ([string isEqualToString:@""]) {
self.label4.text = @"";
return YES;
}
return NO;
}
return YES;
}
return NO;
}
-(void)setType:(QXPasswordViewType)type{
_type = type;
switch (type) {
case QXPasswordViewTypeChirldMode:{
self.titleLabel.text = QXText(@"请输入监护密码");
}
break;
case QXPasswordViewTypeRoom:{
self.titleLabel.text = QXText(@"请输入房间密码");
}
break;
default:
break;
}
}
@end

View File

@@ -0,0 +1,37 @@
//
// QXSettingCell.h
// QXLive
//
// Created by 启星 on 2025/5/12.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger) {
/// 显示左侧label 右侧lable 向右箭头
QXSettingCellTypeNormal = 0,
/// 只显示右侧详细信息
QXSettingCellTypeOnlyDetail = 1,
/// 只显示箭头
QXSettingCellTypeOnlyArrow,
/// 开关
QXSettingCellTypeSwitch,
/// 标题在上 详情在下 带箭头
QXSettingCellTypeTitleTopAndArrow,
/// 标题在上 详情在下 不带箭头
QXSettingCellTypeTitleTopNoArrow
}QXSettingCellType;
NS_ASSUME_NONNULL_BEGIN
@interface QXSettingCell : UITableViewCell
@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UILabel *detailLabel;
@property (strong, nonatomic) UIImageView *rightArrow;
@property (strong, nonatomic) NSLayoutConstraint *rightConstraint;
@property (strong, nonatomic) UIButton *btnSwitch;
@property (strong, nonatomic) UIView *lineView;
@property (assign, nonatomic) QXSettingCellType cellType;
@property (assign, nonatomic) BOOL needLine;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,215 @@
//
// QXSettingCell.m
// QXLive
//
// Created by on 2025/5/12.
//
#import "QXSettingCell.h"
@implementation QXSettingCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXSettingCell";
QXSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXSettingCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubviews];
}
return self;
}
-(void)setCellType:(QXSettingCellType )cellType{
_cellType = cellType;
switch (cellType) {
case QXSettingCellTypeNormal:{
self.detailLabel.hidden = NO;
self.rightArrow.hidden = NO;
self.btnSwitch.hidden = YES;
self.detailLabel.textAlignment = NSTextAlignmentRight;
[self.rightArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.size.mas_equalTo(CGSizeMake(24, 24));
make.centerY.equalTo(self.contentView);
}];
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.detailLabel.mas_left).offset(-10);
}];
[self.detailLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.rightArrow.mas_left).offset(-10);
make.centerY.equalTo(self.contentView);
make.width.mas_equalTo(120);
}];
}
break;
case QXSettingCellTypeOnlyArrow:{
self.detailLabel.hidden = YES;
self.rightArrow.hidden = NO;
self.rightConstraint.constant = 16;
self.btnSwitch.hidden = YES;
[self.rightArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.size.mas_equalTo(CGSizeMake(24, 24));
make.centerY.equalTo(self.contentView);
}];
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.rightArrow.mas_left).offset(-10);
}];
}
break;
case QXSettingCellTypeOnlyDetail:{
self.detailLabel.hidden = NO;
self.rightArrow.hidden = YES;
self.btnSwitch.hidden = YES;
self.detailLabel.textAlignment = NSTextAlignmentRight;
[self.detailLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.centerY.equalTo(self.contentView);
make.width.mas_greaterThanOrEqualTo(120);
}];
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.detailLabel.mas_left).offset(-10);
}];
}
break;
case QXSettingCellTypeSwitch:{
self.detailLabel.hidden = YES;
self.rightArrow.hidden = YES;
self.btnSwitch.hidden = NO;
[self.btnSwitch mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.size.mas_equalTo(CGSizeMake(40, 40));
make.centerY.equalTo(self.contentView);
}];
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.btnSwitch.mas_left).offset(-10);
}];
}
break;
case QXSettingCellTypeTitleTopAndArrow:{
self.detailLabel.hidden = NO;
self.rightArrow.hidden = NO;
self.btnSwitch.hidden = YES;
self.detailLabel.textAlignment = NSTextAlignmentLeft;
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(9);
make.height.mas_equalTo(21);
make.right.equalTo(self.rightArrow.mas_left).offset(-10);
}];
[self.detailLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.equalTo(self.titleLabel.mas_bottom);
make.bottom.equalTo(self.contentView).offset(-9);
make.right.equalTo(self.rightArrow.mas_left).offset(-10);
}];
}
break;
case QXSettingCellTypeTitleTopNoArrow:{
self.detailLabel.hidden = NO;
self.rightArrow.hidden = YES;
self.btnSwitch.hidden = YES;
self.detailLabel.textAlignment = NSTextAlignmentLeft;
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(9);
make.height.mas_equalTo(21);
make.right.equalTo(self.contentView).offset(-10);
}];
[self.detailLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.equalTo(self.titleLabel.mas_bottom);
make.bottom.equalTo(self.contentView).offset(-9);
make.right.equalTo(self.contentView).offset(-10);
}];
}
break;
default:
break;
}
}
-(void)initSubviews{
self.rightArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrowRight"]];
[self.contentView addSubview:self.rightArrow];
[self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.size.mas_equalTo(CGSizeMake(24, 24));
make.centerY.equalTo(self.contentView);
}];
self.btnSwitch = [[UIButton alloc] init];
[self.btnSwitch setImage:[UIImage imageNamed:@"home_switch_off"] forState:(UIControlStateNormal)];
[self.btnSwitch setImage:[UIImage imageNamed:@"home_switch_on"] forState:(UIControlStateSelected)];
[self.btnSwitch addTarget:self action:@selector(btnSwitchAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.contentView addSubview:self.btnSwitch];
[self.btnSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.size.mas_equalTo(CGSizeMake(40, 40));
make.centerY.equalTo(self.contentView);
}];
self.detailLabel = [[UILabel alloc] init];
self.detailLabel.font = [UIFont systemFontOfSize:13];
self.detailLabel.textAlignment = NSTextAlignmentRight;
self.detailLabel.textColor = RGB16(0x494949);
[self.contentView addSubview:self.detailLabel];
[self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.rightArrow.mas_left).offset(-10);
make.centerY.equalTo(self.contentView);
make.width.mas_equalTo(120);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.textColor = RGB16(0x333333);
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.detailLabel.mas_left).offset(-10);
}];
self.lineView = [[UIView alloc] init];
self.lineView.backgroundColor = [UIColor lightGrayColor];
[self.contentView addSubview:self.lineView];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(-16);
make.height.mas_equalTo(0.5);
make.bottom.equalTo(self.contentView);
}];
}
-(void)setNeedLine:(BOOL)needLine{
_needLine = needLine;
self.lineView.hidden = !needLine;
}
- (void)btnSwitchAction:(UIButton *)sender {
sender.selected = !sender.selected;
}
- (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