This commit is contained in:
启星
2025-08-08 10:49:36 +08:00
parent 6400cf78bb
commit b5ce3d580a
8780 changed files with 978183 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
//
// QXDynamicDetailViewController.h
// QXLive
//
// Created by 启星 on 2025/6/4.
//
#import "QXBaseViewController.h"
#import "QXDynamicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXDynamicDetailViewController : QXBaseViewController
@property (nonatomic,strong)QXDynamicModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,317 @@
//
// QXDynamicDetailViewController.m
// QXLive
//
// Created by on 2025/6/4.
//
#import "QXDynamicDetailViewController.h"
#import "QXDynamicListCell.h"
#import "QXDynamicNetwork.h"
#import "QXDynamicCommentCell.h"
#import "QXDynamicCommentHeaderView.h"
#import "QXDynamicCommentInputView.h"
#import "QXAlertView.h"
@interface QXDynamicDetailViewController ()<UITableViewDelegate,UITableViewDataSource,QXDynamicCommentHeaderViewDelegate,QXDynamicCommentInputViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)QXDynamicModel *detailModel;
@property (nonatomic,strong)QXDynamicCommentModel *commentModel;
@property (nonatomic,strong)QXDynamicCommentInputView *commentView;
@end
@implementation QXDynamicDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.commentView.textField resignFirstResponder];
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = QXText(@"动态详情");
}
-(void)initSubViews{
[self.view addSubview:self.tableView];
[self.view addSubview:self.commentView];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
}
-(void)getData{
self.page = 1;
MJWeakSelf
[QXDynamicNetwork dynamicPageWithId:self.model.id successBlock:^(QXDynamicModel * _Nonnull model) {
weakSelf.detailModel = model;
// [weakSelf.tableView reloadSection:0 withRowAnimation:(UITableViewRowAnimationNone)];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
[self getCommentListIsReload:YES];
}
-(void)getCommentListIsReload:(BOOL)isReload{
MJWeakSelf
[QXDynamicNetwork commentListWithId:self.model.id page:self.page successBlock:^(QXDynamicCommentModel *model) {
if (isReload) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:model.list];
if (model.list.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
weakSelf.commentModel = model;
weakSelf.detailModel.comment_num = model.total;
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return self.dataArray.count + 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section == 0) {
return 1;
}else{
QXDynamicCommentListModel *firsModel = self.dataArray[section-1];
return firsModel.replies.count;
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
MJWeakSelf
if (indexPath.section == 0) {
QXDynamicListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QXDynamicListCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
cell.cellType = QXDynamicListCellDetail;
cell.model = self.detailModel?self.detailModel:self.model;
cell.onDeleteBlock = ^(QXDynamicModel * _Nonnull model) {
};
return cell;
}else{
QXDynamicCommentCell *cell = [QXDynamicCommentCell cellWithTableView:tableView];
QXDynamicCommentListModel *firsModel = self.dataArray[indexPath.section-1];
QXDynamicCommentListModel *model = firsModel.replies[indexPath.row];
if (firsModel.replies.count == 1 && indexPath.row == 0) {
cell.topCornerView.layer.cornerRadius = 12;
cell.bottomCornerView.layer.cornerRadius = 12;
}else{
if (indexPath.row == 0) {
cell.topCornerView.layer.cornerRadius = 12;
cell.bottomCornerView.layer.cornerRadius = 0;
}else if (indexPath.row == firsModel.replies.count-1){
cell.topCornerView.layer.cornerRadius = 0;
cell.bottomCornerView.layer.cornerRadius = 12;
}else{
cell.topCornerView.layer.cornerRadius = 0;
cell.bottomCornerView.layer.cornerRadius = 0;
}
}
cell.model = model;
cell.longPressBlock = ^(QXDynamicCommentListModel * _Nonnull model) {
UIAlertController *al = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)];
if ([model.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[al addAction:[UIAlertAction actionWithTitle:QXText(@"删除") style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
[weakSelf didClickDeleteComment:model];
}]];
}
[al addAction:[UIAlertAction actionWithTitle:QXText(@"复制") style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
UIPasteboard *p = [UIPasteboard generalPasteboard];
p.string = [NSString stringWithFormat:@"%@", model.content];
showToast(@"已复制");
}]];
[al addAction:[UIAlertAction actionWithTitle:QXText(@"取消") style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
}]];
[weakSelf presentViewController:al animated:YES completion:nil];
};
return cell;
}
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if (section == 0) {
return [UIView new];
}else{
MJWeakSelf
QXDynamicCommentListModel *firsModel = self.dataArray[section-1];
CGFloat height = [firsModel.content heightForFont:[UIFont systemFontOfSize:14] width:SCREEN_WIDTH-40-16*2-7];
QXDynamicCommentHeaderView *header = [[QXDynamicCommentHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, height+12+40+7+3+9)];
[header addTapBlock:^(id _Nonnull obj) {
weakSelf.commentView.model = firsModel;
weakSelf.commentView.textField.placeholder = [NSString stringWithFormat:@"回复:%@",firsModel.nickname];
[weakSelf.commentView.textField becomeFirstResponder];
}];
header.delegate = self;
header.model = firsModel;
return header;
}
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
if (section == 0) {
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 64)];
footer.backgroundColor = RGB16(0xF6F6F6);
UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 30, SCREEN_WIDTH, 34)];
bgView.backgroundColor = [UIColor whiteColor];
[bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[footer addSubview:bgView];
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, SCREEN_WIDTH-32, 22)];
titleLabel.font = [UIFont boldSystemFontOfSize:16];
titleLabel.textColor = [UIColor blackColor];
[bgView addSubview:titleLabel];
titleLabel.text = [NSString localizedStringWithFormat:QXText(@"全部评论(%@)"),self.commentModel.total?self.commentModel.total:@"0"];
return footer;
}else{
return [UIView new];
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section == 0) {
return 0;
}else{
QXDynamicCommentListModel *firsModel = self.dataArray[section-1];
CGFloat height = [firsModel.content heightForFont:[UIFont systemFontOfSize:14] width:SCREEN_WIDTH-40-16*2-7];
return height+12+40+7+3+9;
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
if (section == 0) {
return 64;
}else{
return 0;
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
return;
}
QXDynamicCommentListModel *firsModel = self.dataArray[indexPath.section-1];
QXDynamicCommentListModel *model = firsModel.replies[indexPath.row];
self.commentView.model = model;
self.commentView.textField.placeholder = [NSString stringWithFormat:@"回复:%@",model.nickname];
[self.commentView.textField becomeFirstResponder];
}
-(void)didClickDeleteComment:(QXDynamicCommentListModel*)model{
MJWeakSelf
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
al.type = QXAlertViewTypeDeleteComment;
al.commitBlock = ^{
[weakSelf deleteCommentWithModel:model];
};
[[QXGlobal shareGlobal] showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
}
-(void)deleteCommentWithModel:(QXDynamicCommentListModel*)model{
MJWeakSelf
[QXDynamicNetwork deleteCommentWithCommentId:model.id successBlock:^(NSDictionary * _Nonnull dict) {
weakSelf.page = 1;
[weakSelf getCommentListIsReload:YES];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)didClickReplyComment:(QXDynamicCommentListModel*)model{
}
#pragma mark -
-(void)didClickSendWithText:(NSString*)text model:(nonnull QXDynamicCommentListModel *)model{
if ([text stringByReplacingOccurrencesOfString:@" " withString:@""].length == 0) {
showToast(@"请填写评论");
return;
}
NSString *pid = @"";
NSString *reply_to = @"";
if (model) {
pid = model.pid?model.pid:model.id;
reply_to = model.user_id;
}else{
pid = @"0";
reply_to = @"0";
}
self.commentView.textField.text = @"";
[self.view endEditing:YES];
MJWeakSelf
[QXDynamicNetwork commentDynamicWithId:self.detailModel.id pid:pid reply_to:reply_to content:text successBlock:^(NSDictionary * _Nonnull dict) {
weakSelf.page = 1;
[weakSelf getCommentListIsReload:YES];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
- (void)keyboardWillHide:(NSNotification *)notification {
self.commentView.model = nil;
self.commentView.textField.placeholder = @"快来发表评论吧";
[UIView animateWithDuration:0.3 animations:^{
self.commentView.y = SCREEN_HEIGHT-TabbarContentHeight;
}];
}
- (void)keyboardWillShow:(NSNotification *)notification {
// CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
// [UIView animateWithDuration:0.3 animations:^{
// self.commentView.y = keyboardFrame.origin.y+TabbarContentHeight;
// }];
}
- (void)keyboardWillChangeFrame:(NSNotification *)notification {
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
[UIView animateWithDuration:0.15 animations:^{
self.commentView.y = keyboardFrame.origin.y-TabbarContentHeight;
}];
}
-(UITableView *)tableView{
if (!_tableView) {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-TabbarContentHeight) style:UITableViewStyleGrouped];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:@"QXDynamicListCell" bundle:nil] forCellReuseIdentifier:@"QXDynamicListCell"];
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 152;
[self.tableView addRoundedCornersWithRadius:16];
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
MJWeakSelf
// _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
// weakSelf.page = 1;
// [weakSelf getDynamicList];
// }];
_tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getCommentListIsReload:NO];
}];
}
return _tableView;
}
-(QXDynamicCommentInputView *)commentView{
if (!_commentView) {
_commentView = [[QXDynamicCommentInputView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-TabbarContentHeight, SCREEN_WIDTH, TabbarContentHeight)];
_commentView.delegate = self;
}
return _commentView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXDynamicViewController.h
// QXLive
//
// Created by 启星 on 2025/4/24.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXDynamicViewController : QXBaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,114 @@
//
// QXDynamicViewController.m
// QXLive
//
// Created by on 2025/4/24.
//
#import "QXDynamicViewController.h"
#import "QXPublishViewController.h"
#import "JXCategoryView.h"
#import "QXExpansionViewController.h"
#import "QXFindViewController.h"
@interface QXDynamicViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
@property (nonatomic,strong)UIButton *publishBtn;
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
@property (nonatomic,strong)QXFindViewController *findVC;
@end
@implementation QXDynamicViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)initSubViews{
// UILabel *tLabel = [[UILabel alloc] init];
// tLabel.text = QXText(@"广场");
// tLabel.font = [UIFont boldSystemFontOfSize:20];
// [self.view addSubview:tLabel];
// [tLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(16);
// make.top.mas_equalTo(kSafeAreaTop +10);
// }];
self.categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(14, kSafeAreaTop, 100, 44)];
self.categoryView.delegate = self;
// self.categoryView.titles = @[QXText(@"发现"),QXText(@"扩列")];
self.categoryView.titles = @[QXText(@"扩列"),QXText(@"发现")];
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
self.categoryView.titleColor = [UIColor colorWithHexString:@"#666666"];
self.categoryView.cellWidth = 50;
self.categoryView.contentEdgeInsetLeft = 0;
self.categoryView.cellSpacing = 0;
// self.categoryView.titleLabelZoomScale = 1.1;
self.categoryView.titleLabelZoomEnabled = YES;
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:16];
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:18];
self.categoryView.averageCellSpacingEnabled = NO;
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
indicatorView.indicatorImageViewSize = CGSizeMake(35, 8);
indicatorView.verticalMargin = 11;
self.categoryView.indicators = @[indicatorView];
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom);
// self.containerView.scrollView.scrollEnabled = NO;
[self.view addSubview:self.categoryView];
[self.view addSubview:self.containerView];
self.categoryView.listContainer = self.containerView;
[self.view addSubview:self.publishBtn];
}
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
return 2;
}
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
// if (index == 0) {
// QXFindViewController *vc = [[QXFindViewController alloc] init];
// self.findVC = vc;
// return vc;
// }else{
// QXExpansionViewController *vc = [[QXExpansionViewController alloc] init];
// return vc;
// }
if (index == 0) {
QXExpansionViewController *vc = [[QXExpansionViewController alloc] init];
return vc;
}else{
QXFindViewController *vc = [[QXFindViewController alloc] init];
self.findVC = vc;
return vc;
}
}
-(void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index{
self.publishBtn.hidden = !(index==1);
}
#pragma mark - action
-(void)pulishAction{
QXPublishViewController *vc = [[QXPublishViewController alloc] init];
MJWeakSelf
vc.publishFinishBlock = ^{
[weakSelf.findVC.tableView.mj_header beginRefreshing];
[weakSelf.findVC getTopicList];
};
[self.navigationController pushViewController:vc animated:YES];
}
-(UIButton *)publishBtn{
if (!_publishBtn) {
_publishBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-44-8, kSafeAreaTop, 44, 44)];
[_publishBtn setImage:[UIImage imageNamed:@"publish_icon"] forState:UIControlStateNormal];
[_publishBtn setImage:[UIImage imageNamed:@"publish_icon"] forState:UIControlStateHighlighted];
[_publishBtn addTarget:self action:@selector(pulishAction) forControlEvents:UIControlEventTouchUpInside];
_publishBtn.hidden = YES;
}
return _publishBtn;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXExpansionViewController.h
// QXLive
//
// Created by 启星 on 2025/5/27.
//
#import "QXBaseViewController.h"
#import "JXCategoryView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXExpansionViewController : QXBaseViewController<JXCategoryListContentViewDelegate>
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,191 @@
//
// QXExpansionViewController.m
// QXLive
//
// Created by on 2025/5/27.
//
#import "QXExpansionViewController.h"
#import "QXExpansionCell.h"
#import "UIButton+QX.h"
#import "QXMenuPopView.h"
#import "QXDynamicNetwork.h"
#import "QXUserHomePageViewController.h"
#import "QXExpansionAppStoreView.h"
@interface QXExpansionViewController ()<UITableViewDelegate,UITableViewDataSource,QXMenuPopViewDelegate>
@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UIButton *sortBtn;
@property (strong, nonatomic) UITableView *tableView;
@property (strong, nonatomic) NSString *type;
@property (strong, nonatomic) QXExpansionAppStoreView *appStoreView;
@end
@implementation QXExpansionViewController
-(UIView *)listView{
return self.view;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil];
}
- (void)initSubViews{
self.page = 1;
self.bgImageHidden = YES;
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, 100, 24)];
self.titleLabel.font = [UIFont systemFontOfSize:16];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.text = QXText(@"扩列交友");
[self.view addSubview:self.titleLabel];
self.sortBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-75-13, 0, 75, 48)];
[self.sortBtn setImage:[[UIImage imageNamed:@"arrow_bottom"] imageByTintColor:QXConfig.textColor] forState:(UIControlStateNormal)];
if ([QXGlobal shareGlobal].loginModel.sex.integerValue == 1) {
[self.sortBtn setTitle:QXText(@"只看女生") forState:(UIControlStateNormal)];
self.type = @"2";
}else{
[self.sortBtn setTitle:QXText(@"只看男生") forState:(UIControlStateNormal)];
self.type = @"1";
}
[self.sortBtn setTitleColor:QXConfig.textColor forState:(UIControlStateNormal)];
self.sortBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.sortBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:3];
[self.sortBtn addTarget:self action:@selector(sortAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:self.sortBtn];
[self.view addSubview:self.tableView];
self.appStoreView.hidden = YES;
[self.view addSubview:self.appStoreView];
MJWeakSelf
self.appStoreView.userBlock = ^(QXUserHomeModel * _Nonnull user) {
if (user == nil) {
return;
}
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
vc.user_id = user.user_id;
[weakSelf.navigationController pushViewController:vc animated:YES];
};
}
-(void)loginSuccess{
[self getData];
}
- (void)getData{
MJWeakSelf
[QXDynamicNetwork expansionListWithPage:self.page type:self.type successBlock:^(NSArray<QXUserHomeModel *> * _Nonnull list, BOOL isAppStore) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
if (isAppStore) {
self.appStoreView.hidden = NO;
self.tableView.hidden = YES;
self.appStoreView.users = list;
}else{
self.tableView.hidden = NO;
self.appStoreView.hidden = YES;
}
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView.mj_header endRefreshing];
if (list.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[self.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
-(void)sortAction{
QXMenuPopView *menuView = [[QXMenuPopView alloc] initWithPoint:CGPointMake(self.sortBtn.centerX, NavContentHeight+self.sortBtn.bottom-10)];
menuView.dataArray = @[QXText(@"只看女生"),QXText(@"只看男生"),QXText(@"查看全部")];
menuView.delegate = self;
[menuView showInView:KEYWINDOW];
}
-(void)didSelectedIndex:(NSInteger)index menuTitle:(NSString *)menuTitle{
QXLOG(@"选择了%@",menuTitle);
if ([menuTitle isEqualToString:QXText(@"只看女生")]) {
self.page = 1;
self.type = @"2";
[self getData];
}else if ([menuTitle isEqualToString:QXText(@"只看男生")]) {
self.page = 1;
self.type = @"1";
[self getData];
}else{
self.page = 1;
self.type = @"0";
[self getData];
}
[self.sortBtn setTitle:menuTitle forState:(UIControlStateNormal)];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXExpansionCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QXExpansionCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
QXUserHomeModel *model = self.dataArray[indexPath.row];
cell.model = model;
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
QXUserHomeModel *model = self.dataArray[indexPath.row];
NSArray *imgArr;
if (model.home_bgimages.length > 0) {
imgArr = [model.home_bgimages componentsSeparatedByString:@","];
}
// NSArray *
CGFloat itemH = 94;
if (imgArr.count == 1) {
itemH = (SCREEN_WIDTH-15-15-15)/2 + 94;
}else if(imgArr.count > 1){
if (imgArr.count > 3) {
itemH = (SCREEN_WIDTH-16*2-12*2-10*2)/3*2+10+94;
}else{
itemH = (SCREEN_WIDTH-16*2-12*2-10*2)/3+94;
}
}else{
itemH = 94;
}
return itemH;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXUserHomeModel *model = self.dataArray[indexPath.row];
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
vc.user_id = model.user_id;
[self.navigationController pushViewController:vc animated:YES];
}
-(UITableView *)tableView{
if (!_tableView) {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+12, SCREEN_WIDTH, self.view.height-TabbarContentHeight-self.titleLabel.bottom-12) style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:@"QXExpansionCell" bundle:nil] forCellReuseIdentifier:@"QXExpansionCell"];
self.tableView.estimatedRowHeight = 94;
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getData];
}];
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getData];
}];
self.tableView.hidden = NO;
}
return _tableView;
}
-(QXExpansionAppStoreView *)appStoreView{
if (!_appStoreView) {
_appStoreView = [[QXExpansionAppStoreView alloc] initWithFrame:self.tableView.bounds];
}
return _appStoreView;
}
@end

View File

@@ -0,0 +1,17 @@
//
// QXFindViewController.h
// QXLive
//
// Created by 启星 on 2025/5/27.
//
#import "QXBaseViewController.h"
#import "JXCategoryView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXFindViewController : QXBaseViewController<JXCategoryListContentViewDelegate>
@property (strong, nonatomic) UITableView *tableView;
-(void)getTopicList;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,215 @@
//
// QXFindViewController.m
// QXLive
//
// Created by on 2025/5/27.
//
#import "QXFindViewController.h"
#import "QXDynamicTopicCell.h"
#import "GKPageControl.h"
#import "QXDynamicListCell.h"
#import "QXDynamicNetwork.h"
#import "QXToppicDynamicViewController.h"
#import "QXDynamicDetailViewController.h"
@interface QXFindViewController ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDelegate,UICollectionViewDataSource>
@property (strong, nonatomic) UICollectionView *collectionView;
@property (strong, nonatomic) NSMutableArray *hotTopicArray;
@property (nonatomic,strong)GKPageControl *pageControl;
@end
@implementation QXFindViewController
-(UIView *)listView{
return self.view;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil];
}
- (void)initSubViews{
self.page = 1;
self.bgImageHidden = YES;
[self.view addSubview:self.collectionView];
[self.view addSubview:self.pageControl];
[self.view addSubview:self.tableView];
[self getTopicList];
[self getDynamicList];
}
-(void)getTopicList{
MJWeakSelf
[QXDynamicNetwork getTopicListWithPage:self.page isTopTopic:YES successBlock:^(NSArray<QXTopicModel *> * _Nonnull hotos) {
if (weakSelf.page == 1) {
[weakSelf.hotTopicArray removeAllObjects];
}
[weakSelf.hotTopicArray addObjectsFromArray:hotos];
if (hotos.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
if (weakSelf.hotTopicArray.count %4 >0) {
weakSelf.pageControl.numberOfPages = self.hotTopicArray.count/4+1;
}else{
weakSelf.pageControl.numberOfPages = self.hotTopicArray.count/4;
}
weakSelf.pageControl.currentPage = 0;
[self.collectionView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)loginSuccess{
[self getTopicList];
[self getDynamicList];
}
-(void)getDynamicList{
MJWeakSelf
[QXDynamicNetwork getDynamicListWithPage:self.page successBlock:^(NSArray<QXDynamicModel *> * _Nonnull hotos) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:hotos];
[weakSelf.tableView.mj_header endRefreshing];
if (hotos.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[self.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
#pragma mark - UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXDynamicListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QXDynamicListCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
cell.cellType = QXDynamicListCellDynamic;
cell.model = self.dataArray[indexPath.row];
// SPTrendListModel *model = self.dataArray[indexPath.row];
// cell.model = model;
MJWeakSelf
cell.onDeleteBlock = ^(QXDynamicModel * _Nonnull model) {
[weakSelf.dataArray removeObject:model];
[weakSelf.tableView reloadSection:indexPath.section withRowAnimation:(UITableViewRowAnimationAutomatic)];
};
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXDynamicModel *model = self.dataArray[indexPath.row];
QXDynamicDetailViewController *vc = [[QXDynamicDetailViewController alloc] init];
vc.model = model;
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.hotTopicArray.count;
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXDynamicTopicCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXDynamicTopicCell" forIndexPath:indexPath];
QXTopicModel *model = self.hotTopicArray[indexPath.row];
cell.model = model;
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXTopicModel *model = self.hotTopicArray[indexPath.row];
QXToppicDynamicViewController *vc = [[QXToppicDynamicViewController alloc] init];
vc.model = model;
[self.navigationController pushViewController:vc animated:YES];
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
if ([scrollView isKindOfClass:[UICollectionView class]]) {
long offsetX = (long)scrollView.contentOffset.x;
int width = SCREEN_WIDTH-32;
int remainder = offsetX % width;
NSInteger index;
if (remainder>(width)/2) {
index = offsetX/width+1;
}else{
index = offsetX/width;
}
self.pageControl.currentPage = index;
}
}
-(UITableView *)tableView{
if (!_tableView) {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.pageControl.bottom+5, SCREEN_WIDTH, SCREEN_HEIGHT-TabbarContentHeight-self.pageControl.bottom-5-13) style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:@"QXDynamicListCell" bundle:nil] forCellReuseIdentifier:@"QXDynamicListCell"];
self.tableView.rowHeight = UITableViewAutomaticDimension;
// self.tableView.estimatedRowHeight = 0;
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getDynamicList];
}];
_tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getDynamicList];
}];
}
return _tableView;
}
-(UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 16;
layout.minimumInteritemSpacing = 16;
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*3)/2, 45);
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(16, 13, SCREEN_WIDTH-32, 45*2+16) collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.pagingEnabled = YES;
_collectionView.bounces = NO;
_collectionView.backgroundColor = [UIColor clearColor];
_collectionView.showsHorizontalScrollIndicator = NO;
[_collectionView registerNib:[UINib nibWithNibName:@"QXDynamicTopicCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXDynamicTopicCell"];
}
return _collectionView;
}
-(GKPageControl *)pageControl{
if (!_pageControl) {
_pageControl = [[GKPageControl alloc] initWithFrame:CGRectMake(0, self.collectionView.bottom+7, SCREEN_WIDTH, 8)];
_pageControl.style = GKPageControlStyleRectangle;
_pageControl.dotWidth = 15;
_pageControl.dotHeight = 5;
_pageControl.dotMargin = 2;
_pageControl.pageIndicatorTintColor = UIColor.whiteColor;
_pageControl.currentPageIndicatorTintColor = QXConfig.textColor;
}
return _pageControl;
}
-(NSMutableArray *)hotTopicArray{
if (!_hotTopicArray) {
_hotTopicArray = [NSMutableArray array];
}
return _hotTopicArray;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end

View File

@@ -0,0 +1,16 @@
//
// QXPublishViewController.h
// QXLive
//
// Created by 启星 on 2025/5/27.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXPublishViewController : QXBaseViewController
@property(nonatomic,copy)void(^publishFinishBlock)(void);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,139 @@
//
// QXPublishViewController.m
// QXLive
//
// Created by on 2025/5/27.
//
#import "QXPublishViewController.h"
#import "QXTextView.h"
#import "QXUserInfoEditFooterView.h"
#import "QXSelectedTopicView.h"
#import "QXTopicListView.h"
#import "QXLocationManager.h"
#import "QXDynamicNetwork.h"
@interface QXPublishViewController ()<QXUserInfoImageCellDelegate,QXLocationManagerDelegate>
@property (nonatomic,strong)QXTextView *textView;
@property (nonatomic,strong)QXSelectedTopicView *topicView;
@property (nonatomic,strong)QXUserInfoEditFooterView *pickerView;
@property (nonatomic,strong)NSString *images;
@property (nonatomic,strong)NSString *city;
@property (nonatomic,strong)UIButton* commitBtn;
@end
@implementation QXPublishViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = QXText(@"动态发布");
}
-(void)initSubViews{
self.topicView = [[QXSelectedTopicView alloc] initWithFrame:CGRectMake(16, NavContentHeight+12, SCREEN_WIDTH-32, 44)];
self.topicView.backgroundColor = RGB16(0xEFF2F8);
[self.topicView addRoundedCornersWithRadius:11];
MJWeakSelf
[self.topicView addTapBlock:^(id _Nonnull obj) {
QXTopicListView *listView = [[QXTopicListView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(374))];
listView.selecctedTopicBlock = ^(NSArray<QXTopicModel *> * _Nonnull topicArr) {
weakSelf.topicView.selectedTopic = topicArr;
};
[[QXGlobal shareGlobal] showView:listView popType:(PopViewTypeBottomToUpActionSheet) tapDismiss:YES finishBlock:^{
}];
}];
[self.view addSubview:self.topicView];
self.textView = [[QXTextView alloc] initWithFrame:CGRectMake(16, self.topicView.bottom+12, SCREEN_WIDTH-32, 180)];
self.textView.placehoulder = QXText(@"此刻想和大家分享点什么");
self.textView.font = [UIFont systemFontOfSize:12];
self.textView.maxLength = 1200;
self.textView.backgroundColor = [UIColor whiteColor];
[self.textView addRoundedCornersWithRadius:7];
[self.view addSubview:self.textView];
int itemWidth = (self.view.width-16*2-20*2)/3;
self.pickerView = [[QXUserInfoEditFooterView alloc] initWithFrame:CGRectMake(0, self.textView.bottom, SCREEN_WIDTH, itemWidth*3+12*2+20*2)];
self.pickerView.backgroundColor = [UIColor clearColor];
self.pickerView.maxCount = 9;
self.pickerView.hideTitle = YES;
self.pickerView.delegate = self;
[self.view addSubview:self.pickerView];
[[QXLocationManager shareManager] startLoction];
[QXLocationManager shareManager].delegate = self;
self.commitBtn = [[UIButton alloc] init];
[self.commitBtn setTitle:QXText(@"发布") forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];;
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:self.commitBtn];
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(38);
make.right.mas_equalTo(-38);
make.height.mas_equalTo(42);
make.bottom.mas_equalTo(-(kSafeAreaBottom));
}];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[self.view endEditing:YES];
}
-(void)commitAction{
// if (self.topicView.selectedTopic.count == 0) {
// showToast(@"请选择话题");
// return;
// }
if (self.textView.text.length == 0) {
showToast(@"发布内容不能为空");
return;
}
// if (self.images.length == 0) {
// showToast(@"请上传图片");
// return;
// }
NSString *topic = @"";
if (self.topicView.selectedTopic.count > 0) {
for (QXTopicModel*md in self.topicView.selectedTopic) {
if (topic.length == 0) {
topic = [topic stringByAppendingFormat:@"%@",md.topic_id];
}else{
topic = [topic stringByAppendingFormat:@",%@",md.topic_id];
}
}
}
MJWeakSelf
[QXDynamicNetwork publishDynamicWithImages:self.images
content:self.textView.text
topic_id:topic
ip:self.city
successBlock:^(NSDictionary * _Nonnull dict) {
if (weakSelf.publishFinishBlock) {
weakSelf.publishFinishBlock();
}
[weakSelf.navigationController popViewControllerAnimated:YES];
}
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)locationSuccessWithCity:(NSString *)city province:(NSString * _Nonnull)province area:(NSString * _Nonnull)area address:(NSString * _Nonnull)address{
[[QXLocationManager shareManager] stopLoction];
self.city = city;
}
-(void)didUploadFinishedWithImageUrlList:(NSArray *)urlList{
self.images = [urlList componentsJoinedByString:@","];
}
@end

View File

@@ -0,0 +1,19 @@
//
// QXReportViewController.h
// QXLive
//
// Created by 启星 on 2025/7/9.
//
#import "QXBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXReportViewController : QXBaseViewController
/// 1-用户2房间3动态&
@property (nonatomic,strong)NSString *reportType;
/// fromId=对应id
@property (nonatomic,strong)NSString *fromId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,214 @@
//
// QXLevelViewController.m
// QXLive
//
// Created by on 2025/5/9.
//
#import "QXReportViewController.h"
#import <WebKit/WebKit.h>
static void *WKWebBrowserContext = &WKWebBrowserContext;
@interface QXReportViewController ()<WKScriptMessageHandler>
@property(nonatomic,strong)WKWebView *contentWebView;
@property(nonatomic,strong)UIProgressView *progressView;
@end
@implementation QXReportViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.view addSubview:self.contentWebView];
[self.view addSubview:self.progressView];
[self layoutConstraints];
[self loadData];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
//-(void)setNavgationItems{
// [super setNavgationItems];
// self.navigationItem.title = @"段位";
//}
- (void)layoutConstraints {
[self.contentWebView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
[self.progressView setFrame:CGRectMake(0, 0, SCREEN_WIDTH
, 2)];
}
- (void)loadData {
// 1-23&fromId=id
NSInteger safeTop = kSafeAreaTop;
NSURL* url= [NSURL URLWithString:[NSString stringWithFormat:@"https://vespa.qxmier.com/web/index.html#/pages/feedback/report?id=%@&fromType=%@&fromId=%@&h=%ld",[QXGlobal shareGlobal].loginModel.token ,self.reportType,self.fromId,safeTop]];
NSURLRequest *request =[NSURLRequest requestWithURL:url];
[self.contentWebView loadRequest:request];
}
#pragma mark - WKNavigationDelegate
//
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
//
self.progressView.hidden = NO;
}
//
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
//
// if (self.title.length == 0) {
// self.navigationItem.title = self.contentWebView.title;
// }
// if ([self.titleString containsString:@"转账"]) {
// //
// NSString *fontFamilyStr = @"document.getElementsByTagName('body')[0].style.fontFamily='Arial';";
// [webView evaluateJavaScript:fontFamilyStr completionHandler:nil];
// //
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextFillColor= '#333333'" completionHandler:nil];
// //
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '150%'"completionHandler:nil];
// }
}
//
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
}
//
- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
}
//
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error{
}
-(void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
NSLog(@"message.name====%@ body=%@",message.name,message.body);
if([message.name isEqualToString:@"nativeHandler"]){
NSDictionary *dict = message.body;
if ([dict[@"action"] isEqualToString:@"closeWeb"]) {
if (self.contentWebView.canGoBack) {
[self.contentWebView goBack];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}
}
}
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
//
if (navigationAction.targetFrame == nil) {
[webView loadRequest:navigationAction.request];
}
NSURL *URL = navigationAction.request.URL;
[self dealSomeThing:URL];
decisionHandler(WKNavigationActionPolicyAllow);
}
- (void)dealSomeThing:(NSURL *)url{
NSString *scheme = [url scheme];
NSString *resourceSpecifier = [url resourceSpecifier];
if ([scheme isEqualToString:@"tel"]) {
NSString *callPhone = [NSString stringWithFormat:@"tel://%@", resourceSpecifier];
/// iOS 10
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
});
}
}
//
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
}
//KVO
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:NSStringFromSelector(@selector(estimatedProgress))] && object == self.contentWebView) {
[self.progressView setAlpha:1.0f];
BOOL animated = self.contentWebView.estimatedProgress > self.progressView.progress;
[self.progressView setProgress:self.contentWebView.estimatedProgress animated:animated];
// Once complete, fade out UIProgressView
if(self.contentWebView.estimatedProgress >= 1.0f) {
[UIView animateWithDuration:0.3f delay:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
[self.progressView setAlpha:0.0f];
} completion:^(BOOL finished) {
[self.progressView setProgress:0.0f animated:NO];
}];
}
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
#pragma mark - getters and setters
- (WKWebView *)contentWebView {
if (!_contentWebView) {
//
WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];
//
configuration.selectionGranularity = YES;
// webpr
configuration.processPool = [[WKProcessPool alloc] init];
//, jsoc(OCURL)
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
//
configuration.suppressesIncrementalRendering = NO;
//
[UserContentController addScriptMessageHandler:self name:@"nativeHandler"];
configuration.preferences.javaScriptEnabled = YES;
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
configuration.userContentController = UserContentController;
// iOS9iOS8
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
//
configuration.allowsAirPlayForMediaPlayback = YES;
// 线
configuration.allowsInlineMediaPlayback = YES;
// NOios8
_contentWebView.allowsBackForwardNavigationGestures = YES;
}
_contentWebView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];
_contentWebView.backgroundColor = [UIColor clearColor];
_contentWebView.opaque = YES;
//
[_contentWebView sizeToFit];
_contentWebView.scrollView.showsVerticalScrollIndicator = NO;
//
_contentWebView.navigationDelegate = self;
//kvo
[_contentWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:WKWebBrowserContext];
}
return _contentWebView;
}
- (UIProgressView *)progressView {
if (!_progressView) {
_progressView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
[_progressView setTrackTintColor:[UIColor colorWithRed:240.0/255 green:240.0/255 blue:240.0/255 alpha:1.0]];
_progressView.progressTintColor = QXConfig.themeColor;
}
return _progressView;
}
-(void)setProgressColor:(UIColor *)progressColor{
_progressView.progressTintColor = progressColor;
}
// dealloc
- (void)dealloc {
if (self) {
[self.contentWebView removeObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress))];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXToppicDynamicViewController.h
// QXLive
//
// Created by 启星 on 2025/6/3.
//
#import "QXBaseViewController.h"
#import "QXDynamicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXToppicDynamicViewController : QXBaseViewController
@property (nonatomic,strong)QXTopicModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,106 @@
//
// QXToppicDynamicViewController.m
// QXLive
//
// Created by on 2025/6/3.
//
#import "QXToppicDynamicViewController.h"
#import "QXDynamicListCell.h"
#import "QXToppicDynamicTopView.h"
#import "QXDynamicNetwork.h"
@interface QXToppicDynamicViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) UITableView *tableView;
@property (strong, nonatomic) QXToppicDynamicTopView *topView;
@end
@implementation QXToppicDynamicViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = self.model.title;
}
-(void)initSubViews{
self.page = 1;
self.tableView.tableHeaderView = self.topView;
[self.view addSubview:self.tableView];
[self getDynamicList];
}
-(void)getDynamicList{
MJWeakSelf
[QXDynamicNetwork topicDynamicListWithTopic_id:self.model.topic_id page:self.page successBlock:^(NSArray<QXDynamicModel *> * _Nonnull list) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView.mj_header endRefreshing];
if (list.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[self.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
#pragma mark - UITableViewDelegate,UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXDynamicListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QXDynamicListCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
cell.model = self.dataArray[indexPath.row];
// SPTrendListModel *model = self.dataArray[indexPath.row];
// cell.model = model;
MJWeakSelf
cell.onDeleteBlock = ^(QXDynamicModel * _Nonnull model) {
[weakSelf.dataArray removeObject:model];
[weakSelf.tableView reloadSection:indexPath.section withRowAnimation:(UITableViewRowAnimationAutomatic)];
};
return cell;
}
-(UITableView *)tableView{
if (!_tableView) {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:@"QXDynamicListCell" bundle:nil] forCellReuseIdentifier:@"QXDynamicListCell"];
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 152;
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getDynamicList];
}];
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getDynamicList];
}];
}
return _tableView;
}
-(QXToppicDynamicTopView *)topView{
if (!_topView) {
_topView = [[QXToppicDynamicTopView alloc] initWithModel:self.model];
}
return _topView;
}
@end

View File

@@ -0,0 +1,130 @@
//
// QXDynamicModel.h
// QXLive
//
// Created by 启星 on 2025/5/29.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class QXTopicModel,QXDynamicLikeModel;
@interface QXDynamicModel : NSObject
/// 动态id
@property (nonatomic,strong)NSString *id;
/// 用户id
@property (nonatomic,strong)NSString *user_id;
/// 用户id
@property (nonatomic,strong)NSString *user_code;
/// 图片,隔开
@property (nonatomic,strong)NSString *images;
/// 性别 1男2女
@property (nonatomic,strong)NSString *sex;
/// 内容
@property (nonatomic,strong)NSString *content;
/// 点赞数
@property (nonatomic,strong)NSString *like_num;
/// 评论数
@property (nonatomic,strong)NSString *comment_num;
/// 话题名称
@property (nonatomic,strong)NSArray<QXTopicModel*> *title;
/// 打赏金额
@property (nonatomic,strong)NSString *rewards_num;
/// 是否点赞1点0未
@property (nonatomic,strong)NSString *is_like;
/// 作者是否在房间中1在0不在
@property (nonatomic,strong)NSString *is_room;
/// 作者所在房间ID is_room =0 此值小于0
@property (nonatomic,strong)NSString *room_id;
/// 头像
@property (nonatomic,strong)NSString *avatar;
/// 装扮
@property (nonatomic,strong)NSString *dress;
/// 昵称
@property (nonatomic,strong)NSString *nickname;
/// 时间
@property (nonatomic,strong)NSString *createtime;
/// 是否为推荐
@property (nonatomic,strong)NSString *is_recommend;
/// 昵称
@property (nonatomic,strong)NSString *share_url;
@property (nonatomic,strong)NSArray<QXDynamicLikeModel*> *like_list;
@end
@interface QXTopicModel : NSObject<YYModel>
/// id
@property (nonatomic,strong)NSString *topic_id;
/// 话题描述
@property (nonatomic,strong)NSString *content;
/// 话题名称
@property (nonatomic,strong)NSString *title;
/// 话题图片
@property (nonatomic,strong)NSString *pic;
/// 多少条动态
@property (nonatomic,strong)NSString *count;
/// 选择
@property (nonatomic,assign)BOOL isSelected;
@end
#pragma mark - 点赞列表
@interface QXDynamicLikeModel : NSObject<YYModel>
/// 用户id
@property (nonatomic,strong)NSString *user_id;
/// 昵称
@property (nonatomic,strong)NSString *nickname;
/// 头像
@property (nonatomic,strong)NSString *avatar;
/// 年龄
@property (nonatomic,strong)NSString *age;
/// 星座
@property (nonatomic,strong)NSString *constellation;
/// 生日
@property (nonatomic,strong)NSString *birthday;
/// 性别 1 男 2女
@property (nonatomic,strong)NSString *sex;
@end
#pragma mark - 评论列表
@class QXDynamicCommentListModel;
@interface QXDynamicCommentModel : NSObject
@property (nonatomic,strong)NSArray<QXDynamicCommentListModel*>* list;
/// 总评论数
@property (nonatomic,strong)NSString* total;
@end
@interface QXDynamicCommentListModel : NSObject
/// 评论ID
@property (nonatomic,strong)NSString *id;
/// 动态ID
@property (nonatomic,strong)NSString *zone_id;
/// 评论内容
@property (nonatomic,strong)NSString *content;
/// 时间
@property (nonatomic,strong)NSString *createtime;
/// 评论者ID
@property (nonatomic,strong)NSString *user_id;
/// 评论者
@property (nonatomic,strong)NSString *nickname;
/// 评论者头像
@property (nonatomic,strong)NSString *avatar;
/// 评论者是否作者 0不是1
@property (nonatomic,strong)NSString *is_author;
/// 二级评论
@property (nonatomic,strong)NSArray<QXDynamicCommentListModel*> *replies;
/// 以上为一级评论 下面是二级评论
/// 回复给谁的ID
@property (nonatomic,strong)NSString *reply_to;
/// 上级评论的ID
@property (nonatomic,strong)NSString *pid;
/// 回复给谁
@property (nonatomic,strong)NSString *reply_to_user;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,51 @@
//
// QXDynamicModel.m
// QXLive
//
// Created by on 2025/5/29.
//
#import "QXDynamicModel.h"
@implementation QXDynamicModel
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"title" : @"QXTopicModel",
@"like_list":@"QXDynamicLikeModel"
};
}
@end
@implementation QXTopicModel
@end
@implementation QXDynamicLikeModel
@end
@implementation QXDynamicCommentModel
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"list" : @"QXDynamicCommentListModel",
};
}
@end
@implementation QXDynamicCommentListModel
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"replies" : @"QXDynamicCommentListModel",
};
}
@end

View File

@@ -0,0 +1,153 @@
//
// QXDynamicNetwork.h
// QXLive
//
// Created by 启星 on 2025/5/30.
//
#import <Foundation/Foundation.h>
#import "QXDynamicModel.h"
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXDynamicNetwork : NSObject
/**
发布动态
images用,隔开
*/
+(void)publishDynamicWithImages:(NSString*)images
content:(NSString*)content
topic_id:(NSString*)topic_id
ip:(NSString*)ip
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
动态列表
*/
+(void)getDynamicListWithPage:(NSInteger)page
successBlock:(void (^)(NSArray<QXDynamicModel*>*hotos))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
话题列表
*/
+(void)getTopicListWithPage:(NSInteger)page
isTopTopic:(BOOL)isTopTopic
successBlock:(void (^)(NSArray<QXTopicModel*>*hotos))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
扩列列表
*/
+(void)expansionListWithPage:(NSInteger)page
type:(NSString*)type
successBlock:(void (^)(NSArray<QXUserHomeModel*>*list,BOOL isAppStore))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
动态打赏
is_pack 1金币购买2背包礼物
*/
+(void)dynamicGiveGiftWithId:(NSString*)Id
gift_id:(NSString*)gift_id
num:(NSString*)num
is_pack:(NSString*)is_pack
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
动态打赏列表
*/
+(void)dynamicGiveGiftListWithId:(NSString*)Id
successBlock:(void (^)(NSArray<QXUserHomeModel*>* list))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
动态点赞
*/
+(void)likeDynamicWithId:(NSString*)Id
isLike:(BOOL)isLike
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
删除动态
*/
+(void)deleteDynamicWithId:(NSString*)Id
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
话题动态
*/
+(void)topicDynamicListWithTopic_id:(NSString*)topic_id
page:(NSInteger)page
successBlock:(void (^)(NSArray<QXDynamicModel*>*list))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
动态详情
*/
+(void)dynamicPageWithId:(NSString*)Id
successBlock:(void (^)(QXDynamicModel*model))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
评论列表
*/
+(void)commentListWithId:(NSString*)Id
page:(NSInteger)page
successBlock:(void (^)(QXDynamicCommentModel* model))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
点赞列表
*/
+(void)likeListWithId:(NSString*)Id
page:(NSInteger)page
successBlock:(void (^)(NSArray<QXDynamicLikeModel*>* list))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
评论动态/回复评论
*/
+(void)commentDynamicWithId:(NSString*)Id
pid:(NSString*)pid
reply_to:(NSString*)reply_to
content:(NSString*)content
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
删除评论
*/
+(void)deleteCommentWithCommentId:(NSString*)Id
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
互关用户列表
*/
+(void)mutualRelationshipWithPage:(NSInteger)page
successBlock:(void (^)(NSArray<QXDynamicLikeModel*>*hotos))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
关注
type 1 用户 2房间
*/
+(void)followWithUserId:(NSString*)userId
type:(NSString*)type
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,318 @@
//
// QXDynamicNetwork.m
// QXLive
//
// Created by on 2025/5/30.
//
#import "QXDynamicNetwork.h"
@implementation QXDynamicNetwork
+(void)publishDynamicWithImages:(NSString*)images
content:(NSString*)content
topic_id:(NSString*)topic_id
ip:(NSString*)ip
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
if (images.length > 0) {
[parameters setObject:images forKey:@"images"];
}
[parameters setObject:content forKey:@"content"];
if (topic_id.length > 0) {
[parameters setObject:topic_id forKey:@"topic_id"];
}
if (ip.length > 0) {
[parameters setObject:ip forKey:@"ip"];
}
[[QXRequset shareInstance] postWithUrl:QXDynamicPublish parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)getDynamicListWithPage:(NSInteger)page
successBlock:(void (^)(NSArray<QXDynamicModel *> * _Nonnull))successBlock
failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"page":[NSNumber numberWithInteger:page]
};
[[QXRequset shareInstance] postWithUrl:QXDynamicList parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray *list = [NSArray yy_modelArrayWithClass:[QXDynamicModel class] json:responseObject[@"data"]];
successBlock(list);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)getTopicListWithPage:(NSInteger)page
isTopTopic:(BOOL)isTopTopic
successBlock:(void (^)(NSArray<QXTopicModel *> * _Nonnull))successBlock
failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"page":[NSNumber numberWithInteger:page]
};
NSString *url = QXTopicList;
if (isTopTopic) {
url = QXTopTopic;
}
[[QXRequset shareInstance] postWithUrl:url parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray *list = [NSArray yy_modelArrayWithClass:[QXTopicModel class] json:responseObject[@"data"]];
successBlock(list);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)expansionListWithPage:(NSInteger)page
type:(NSString*)type
successBlock:(void (^)(NSArray<QXUserHomeModel*>*list,BOOL isAppStore))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
NSDictionary *parameters = @{
@"page":[NSNumber numberWithInteger:page],
@"type":type
};
[[QXRequset shareInstance] postWithUrl:QXExpandList parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray *list = [NSArray yy_modelArrayWithClass:[QXUserHomeModel class] json:responseObject[@"data"]];
BOOL isAppStroe = [responseObject[@"api_version"] boolValue];
successBlock(list,isAppStroe);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)dynamicGiveGiftWithId:(NSString *)Id
gift_id:(NSString*)gift_id
num:(NSString*)num
is_pack:(NSString*)is_pack
successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"id":Id,
@"gift_id":gift_id,
@"num":num,
@"is_pack":is_pack
};
[[QXRequset shareInstance] postWithUrl:QXDynamicGive parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)dynamicGiveGiftListWithId:(NSString *)Id successBlock:(void (^)(NSArray<QXUserHomeModel *> * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"id":Id,
};
[[QXRequset shareInstance] postWithUrl:QXDynamicGiveList parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray *list = [NSArray yy_modelArrayWithClass:[QXUserHomeModel class] json:responseObject[@"data"]];
successBlock(list);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)likeDynamicWithId:(NSString*)Id
isLike:(BOOL)isLike
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
NSDictionary *parameters = @{
@"id":Id
};
[[QXRequset shareInstance] postWithUrl:QXDynamicLike parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)deleteDynamicWithId:(NSString *)Id successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"id":Id
};
[[QXRequset shareInstance] postWithUrl:QXDynamicDelete parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)topicDynamicListWithTopic_id:(NSString *)topic_id
page:(NSInteger)page
successBlock:(void (^)(NSArray<QXDynamicModel *> * _Nonnull))successBlock
failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"page":[NSNumber numberWithInteger:page],
@"topic_id":topic_id
};
[[QXRequset shareInstance] postWithUrl:QXDynamicTopicPage parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray *list = [NSArray yy_modelArrayWithClass:[QXDynamicModel class] json:responseObject[@"data"]];
successBlock(list);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)dynamicPageWithId:(NSString *)Id
successBlock:(void (^)(QXDynamicModel * _Nonnull))successBlock
failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"id":Id
};
[[QXRequset shareInstance] postWithUrl:QXDynamicDetail parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
QXDynamicModel *model = [QXDynamicModel yy_modelWithJSON:responseObject[@"data"]];
successBlock(model);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)commentListWithId:(NSString *)Id page:(NSInteger)page successBlock:(void (^)(QXDynamicCommentModel* model))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"page":[NSNumber numberWithInteger:page],
@"id":Id
};
[[QXRequset shareInstance] postWithUrl:QXDynamicCommentList parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
QXDynamicCommentModel *model = [QXDynamicCommentModel yy_modelWithJSON:responseObject[@"data"]];
successBlock(model);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)likeListWithId:(NSString *)Id page:(NSInteger)page successBlock:(void (^)(NSArray<QXDynamicLikeModel *> * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"page":[NSNumber numberWithInteger:page],
@"id":Id
};
[[QXRequset shareInstance] postWithUrl:QXDynamicLikeList parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray *list = [NSArray yy_modelArrayWithClass:[QXDynamicLikeModel class] json:responseObject[@"data"]];
successBlock(list);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)commentDynamicWithId:(NSString *)Id pid:(NSString*)pid reply_to:(NSString*)reply_to content:(NSString*)content successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"pid":pid,
@"id":Id,
@"reply_to":reply_to,
@"content":content
};
[[QXRequset shareInstance] postWithUrl:QXDynamicComment parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)deleteCommentWithCommentId:(NSString *)Id successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"id":Id,
};
[[QXRequset shareInstance] postWithUrl:QXDynamicDeleteComment parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)mutualRelationshipWithPage:(NSInteger)page successBlock:(void (^)(NSArray<QXDynamicLikeModel *> * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters = @{
@"page":[NSNumber numberWithInteger:page]
};
[[QXRequset shareInstance] postWithUrl:QXDynamicMutualRelationship parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray *list = [NSArray yy_modelArrayWithClass:[QXDynamicLikeModel class] json:responseObject[@"data"]];
successBlock(list);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
+(void)followWithUserId:(NSString*)userId
type:(NSString*)type
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
NSDictionary *parameters = @{
@"user_id":userId,
@"type":type
};
[[QXRequset shareInstance] postWithUrl:QXUserFollow parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
if (failBlock) {
failBlock(error,msg);
}
}];
}
@end

View File

@@ -0,0 +1,26 @@
//
// QXDynamicLikeListView.h
// QXLive
//
// Created by 启星 on 2025/6/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXDynamicLikeListView : UIView
@property (nonatomic,strong)NSString *Id;
@property (nonatomic,strong)NSString *num;
-(void)showInView:(UIView*)view;
-(void)hide;
@end
@interface QXDynamicLikeListCell : UITableViewCell
@property (nonatomic,strong)UIImageView *headerImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *infoLabel;
@property (nonatomic,strong)QXDynamicLikeModel *model;
+(instancetype)cellWithTableView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,187 @@
//
// QXDynamicLikeListView.m
// QXLive
//
// Created by on 2025/6/3.
//
#import "QXDynamicLikeListView.h"
#import "QXDynamicNetwork.h"
@class QXDynamicLikeListCell;
@interface QXDynamicLikeListView()<UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate>
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,assign)NSInteger page;
@end
@implementation QXDynamicLikeListView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(347);
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXDynamicLikeListCell *cell = [QXDynamicLikeListCell cellWithTableView:tableView];
cell.model = self.dataArray[indexPath.row];
return cell;
}
-(void)initSubviews{
self.page = 1;
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(347))];
self.bgView.backgroundColor = [UIColor whiteColor];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, self.bgView.width-32, 27)];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
[self.bgView addSubview:self.titleLabel];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+5, self.bgView.width, self.bgView.height-self.titleLabel.bottom-5) style:(UITableViewStylePlain)];
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.rowHeight = 53;
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getLikeList];
}];
_tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getLikeList];
}];
[self.bgView addSubview:self.tableView];
}
-(void)setId:(NSString *)Id{
_Id = Id;
[self getLikeList];
}
-(void)setNum:(NSString *)num{
_num = num;
self.titleLabel.text = num;
}
-(void)getLikeList{
MJWeakSelf
[QXDynamicNetwork likeListWithId:self.Id page:self.page successBlock:^(NSArray<QXDynamicLikeModel *> * _Nonnull list) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:list];
if (list.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_footer endRefreshing];
[weakSelf.tableView.mj_header endRefreshing];
}];
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXDynamicLikeListCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString* cellId = @"QXDynamicLikeListCell";
QXDynamicLikeListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXDynamicLikeListCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.headerImageView addRoundedCornersWithRadius:20];
[self.contentView addSubview:self.headerImageView];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = QXConfig.textColor;
self.nameLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.nameLabel];
self.infoLabel = [[UILabel alloc] init];
self.infoLabel.textColor = RGB16(0x999999);
self.infoLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.infoLabel];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.size.mas_equalTo(CGSizeMake(40, 40));
make.centerY.equalTo(self);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerImageView.mas_right).offset(8);
make.height.mas_equalTo(21);
make.top.equalTo(self.headerImageView).offset(-2);
}];
[self.infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerImageView.mas_right).offset(8);
make.height.mas_equalTo(21);
make.top.equalTo(self.nameLabel.mas_bottom);
}];
}
-(void)setModel:(QXDynamicLikeModel *)model{
_model = model;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.nameLabel.text = model.nickname;
self.infoLabel.text = [NSString stringWithFormat:@"%@/%@/%@",model.sex.intValue==1?@"男":@"女",model.age,model.constellation];
}
@end

View File

@@ -0,0 +1,50 @@
//
// QXDynamicListCell.h
// SweetParty
//
// Created by bj_szd on 2022/6/1.
//
#import <UIKit/UIKit.h>
#import "QXDynamicModel.h"
#import "QXSeatHeaderView.h"
typedef NS_ENUM(NSInteger) {
QXDynamicListCellDynamic = 0,
QXDynamicListCellDetail ,
QXDynamicListCellHomePage ,
}QXDynamicListCellType;
NS_ASSUME_NONNULL_BEGIN
@interface QXDynamicListCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet QXSeatHeaderView *avatarImgV;
@property (weak, nonatomic) IBOutlet UILabel *nicknameLab;
@property (weak, nonatomic) IBOutlet UIImageView *sexImgV;
@property (weak, nonatomic) IBOutlet UILabel *timeLab;
@property (weak, nonatomic) IBOutlet UIButton *focusBtn;
@property (weak, nonatomic) IBOutlet UILabel *contentLab;
@property (weak, nonatomic) IBOutlet UIView *imgsBgView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imgsBgViewHeightCon;
@property (weak, nonatomic) IBOutlet UIButton *commentBtn;
@property (weak, nonatomic) IBOutlet UIButton *zanBtn;
@property (weak, nonatomic) IBOutlet UIButton *giveBtn;
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
@property (weak, nonatomic) IBOutlet UIImageView *userImageView1;
@property (weak, nonatomic) IBOutlet UIImageView *userImageView2;
@property (weak, nonatomic) IBOutlet UIImageView *userImageView3;
@property (weak, nonatomic) IBOutlet UILabel *likeCountLabel;
@property (weak, nonatomic) IBOutlet UIButton *likeViewBtn;
@property (nonatomic, copy) void(^onDeleteBlock)(QXDynamicModel*model);
@property (nonatomic, strong) QXDynamicModel *model;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgLeftCon;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgRightCon;
@property (nonatomic, assign) QXDynamicListCellType cellType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,390 @@
//
// QXDynamicListCell.m
// SweetParty
//
// Created by bj_szd on 2022/6/1.
//
#import "QXDynamicListCell.h"
//#import "UILabel+ChangeSpace.h"
//#import "KNPhotoBrowser.h"
//#import "SPTrendReportVC.h"
#import "QXSendGiftView.h"
#import "YBImageBrowser.h"
#import "QXDynamicNetwork.h"
#import "QXShareView.h"
#import "QXAlertView.h"
#import "QXDynamicDetailViewController.h"
#import "QXUserHomePageViewController.h"
#import "QXDynamicLikeListView.h"
#import "QXReportViewController.h"
@interface QXDynamicListCell ()<QXShareViewDelegate>
@property (nonatomic, strong) NSMutableArray *imgViewsArray;
@property (nonatomic, strong)QXSendGiftView *sendView;
@end
@implementation QXDynamicListCell
- (void)awakeFromNib {
[super awakeFromNib];
self.imgViewsArray = [NSMutableArray arrayWithCapacity:6];
self.zanBtn.needEventInterval = 0.5;
[self createUI];
}
-(void)setCellType:(QXDynamicListCellType)cellType{
_cellType = cellType;
}
- (void)setModel:(QXDynamicModel *)model {
_model = model;
[self.avatarImgV setHeadIcon:model.avatar dress:@""];
self.nicknameLab.text = model.nickname;
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.zanBtn.selected = model.is_like.integerValue == 0?NO:YES;
self.timeLab.text = time;
UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"];
self.sexImageView.image = sexImage;
// self.focusBtn.selected = model.is_follow;
//// self.focusBtn.backgroundColor = model.is_follow ? HEXCOLOR(0x383841) : mainDeepColor;
//
// self.focusBtn.hidden = [BJUserManager.userInfo.uid integerValue] == [model.uid integerValue];
NSString *topic = @"";
for (QXTopicModel *md in model.title) {
if (topic.length == 0) {
topic = [topic stringByAppendingFormat:@"%@",md.title];
}else{
topic = [topic stringByAppendingFormat:@" %@",md.title];
}
}
NSString *content = [NSString stringWithFormat:@"%@ %@",model.content,topic];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:content];
[attr yy_setColor:QXConfig.themeColor range:[content rangeOfString:topic]];
self.contentLab.attributedText = attr;
// [UILabel changeLineSpaceForLabel:self.contentLab WithSpace:5];
//
// NSString *topic = [model.title stringByReplacingOccurrencesOfString:@"#" withString:@""];
// self.topicLabel.text = topic;
[self.commentBtn setTitle:[NSString qx_showHotCountNum:model.comment_num.longLongValue] forState:UIControlStateNormal];
[self.zanBtn setTitle:[NSString stringWithFormat:@"%@", [NSString qx_showHotCountNum:model.like_num.longLongValue]] forState:UIControlStateNormal];
self.zanBtn.selected = [model.is_like isEqualToString:@"1"]?YES:NO;
[self.giveBtn setTitle:[NSString qx_showHotCountNum:model.rewards_num.longLongValue] forState:(UIControlStateNormal)];
self.imgsBgView.hidden = YES;
self.imgsBgViewHeightCon.constant = 0;
for (UIImageView *imgV in self.imgViewsArray) {
imgV.hidden = YES;
}
CGFloat imgWidth = (SCREEN_WIDTH-16*2-12*2-10*2)/3;
UIImageView *firstImgV = self.imgViewsArray.firstObject;
[firstImgV mas_updateConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(imgWidth, imgWidth));
}];
NSArray *images;
if (model.images.length > 0) {
images = [model.images componentsSeparatedByString:@","];
}
if (images.count > 0) {
for (NSInteger i = 0; i < images.count; i++) {
if (i < self.imgViewsArray.count) {
UIImageView *imgV = self.imgViewsArray[i];
imgV.hidden = NO;
[imgV sd_setImageWithURL:[NSURL URLWithString:images[i]]];
}
}
if (images.count == 1) {//
CGFloat itemW = (SCREEN_WIDTH-15-15-15)/2;
CGFloat imgBgHeight = itemW;
self.imgsBgView.hidden = NO;
self.imgsBgViewHeightCon.constant = imgBgHeight;
[firstImgV mas_updateConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(itemW, imgBgHeight));
}];
}else {
CGFloat itemW = (SCREEN_WIDTH-16*2-12*2-10*2)/3;
CGFloat imgBgHeight = 0;
NSInteger lines = images.count%3 == 0 ? images.count/3 : images.count/3+1;
imgBgHeight = itemW*lines + 10*(lines-1);
self.imgsBgView.hidden = NO;
self.imgsBgViewHeightCon.constant = imgBgHeight;
}
}
if (model.room_id.intValue > 0) {
[self setBtnTypeWithIsFollow:YES];
}else{
[self setBtnTypeWithIsFollow:NO];
}
if (self.cellType == QXDynamicListCellDetail) {
self.bgLeftCon.constant = 0;
self.bgRightCon.constant = 0;
if (model.like_list.count == 0) {
self.userImageView1.hidden = YES;
self.userImageView2.hidden = YES;
self.userImageView3.hidden = YES;
self.likeViewBtn.hidden = YES;
self.likeCountLabel.hidden = YES;
}else if (model.like_list.count == 1) {
self.likeViewBtn.hidden = NO;
self.likeCountLabel.hidden = NO;
self.userImageView1.hidden = NO;
QXDynamicLikeModel *md = model.like_list.firstObject;
[self.userImageView1 sd_setImageWithURL:[NSURL URLWithString:md.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.userImageView2.hidden = YES;
self.userImageView3.hidden = YES;
self.likeCountLabel.text = [NSString localizedStringWithFormat:QXText(@"等%@人点赞"),self.zanBtn.titleLabel.text];
}else if(model.like_list.count == 2){
self.likeCountLabel.hidden = NO;
self.userImageView1.hidden = NO;
self.userImageView1.hidden = NO;
self.userImageView2.hidden = NO;
QXDynamicLikeModel *md1 = model.like_list.firstObject;
[self.userImageView1 sd_setImageWithURL:[NSURL URLWithString:md1.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
QXDynamicLikeModel *md2 = model.like_list[1];
[self.userImageView2 sd_setImageWithURL:[NSURL URLWithString:md2.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.userImageView3.hidden = YES;
self.likeCountLabel.text = [NSString localizedStringWithFormat:QXText(@"等%@人点赞"),self.zanBtn.titleLabel.text];
}else{
self.likeCountLabel.hidden = NO;
self.userImageView1.hidden = NO;
self.userImageView1.hidden = NO;
self.userImageView2.hidden = NO;
self.userImageView3.hidden = NO;
QXDynamicLikeModel *md1 = model.like_list.firstObject;
[self.userImageView1 sd_setImageWithURL:[NSURL URLWithString:md1.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
QXDynamicLikeModel *md2 = model.like_list[1];
[self.userImageView2 sd_setImageWithURL:[NSURL URLWithString:md2.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
QXDynamicLikeModel *md3 = model.like_list[2];
[self.userImageView3 sd_setImageWithURL:[NSURL URLWithString:md3.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.likeCountLabel.text = [NSString localizedStringWithFormat:QXText(@"等%@人点赞"),self.zanBtn.titleLabel.text];
}
self.focusBtn.hidden = NO;
}else if (self.cellType == QXDynamicListCellDynamic) {
self.userImageView1.hidden = YES;
self.userImageView2.hidden = YES;
self.userImageView3.hidden = YES;
self.likeViewBtn.hidden = YES;
self.likeCountLabel.hidden = YES;
self.focusBtn.hidden = NO;
}else{
self.userImageView1.hidden = YES;
self.userImageView2.hidden = YES;
self.userImageView3.hidden = YES;
self.likeViewBtn.hidden = YES;
self.likeCountLabel.hidden = YES;
self.focusBtn.hidden = YES;
}
if ([self.model.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
self.focusBtn.hidden = YES;
}
}
- (void)createUI {
CGFloat imgWidth = (SCREEN_WIDTH-16*2-12*2-10*2)/3;
for (NSInteger i = 0; i < 9; i++) {
UIImageView *imgV = [[UIImageView alloc] init];
imgV.tag = i+100;
imgV.userInteractionEnabled = YES;
MJWeakSelf
// [imgV dg_Tapped:^{
// [weakSelf onPreviewImage:imgV];
// }];
[imgV addTapBlock:^(id _Nonnull obj) {
[weakSelf previewPhotoWithCurrentIndex:imgV.tag-100];
}];
imgV.hidden = YES;
imgV.layer.masksToBounds = YES;
imgV.layer.cornerRadius = 10;
imgV.contentMode = UIViewContentModeScaleAspectFill;
[self.imgsBgView addSubview:imgV];
[self.imgViewsArray addObject:imgV];
[imgV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.imgsBgView).offset((imgWidth+10)*(i/3));
make.left.equalTo(self.imgsBgView).offset((imgWidth+10)*(i%3));
make.size.mas_equalTo(CGSizeMake(imgWidth, imgWidth));
}];
}
}
-(void)previewPhotoWithCurrentIndex:(NSInteger)currentIndex{
NSArray *images = [self.model.images componentsSeparatedByString:@","];
YBImageBrowser *browser = [YBImageBrowser new];
NSMutableArray *sourceArray = [NSMutableArray array];
for (int i = 0 ; i <images.count;i++) {
NSString *url = images[i];
YBIBImageData *data = [[YBIBImageData alloc] init];
data.imageURL = [NSURL URLWithString:url];
UIImageView *imageView = [self viewWithTag:100+i];
data.projectiveView = imageView;
[sourceArray addObject:data];
}
browser.dataSourceArray = sourceArray;
browser.currentPage = currentIndex;
[browser show];
}
- (IBAction)onFocus:(id)sender {
if (self.model.room_id.intValue > 0) {
//
[[QXGlobal shareGlobal] joinRoomWithRoomId:self.model.room_id isRejoin:NO navagationController:self.navigationController];
}else{
//
//
[[QXGlobal shareGlobal] chatWithUserID:self.model.user_id nickname:self.model.nickname avatar:self.model.avatar navagationController:self.navigationController];
}
}
- (IBAction)commentAction:(id)sender {
switch (self.cellType) {
case QXDynamicListCellDetail:
break;
case QXDynamicListCellDynamic:{
QXDynamicDetailViewController *vc = [[QXDynamicDetailViewController alloc] init];
vc.model = self.model;
[self.navigationController pushViewController:vc animated:YES];
}
break;
case QXDynamicListCellHomePage:{
QXDynamicDetailViewController *vc = [[QXDynamicDetailViewController alloc] init];
vc.model = self.model;
[self.navigationController pushViewController:vc animated:YES];
}
break;
default:
break;
}
}
- (IBAction)onZan:(UIButton*)sender {
BOOL isLike = !sender.selected;
MJWeakSelf
[QXDynamicNetwork likeDynamicWithId:self.model.id isLike:isLike successBlock:^(NSDictionary * _Nonnull dict) {
weakSelf.zanBtn.selected = !weakSelf.zanBtn.selected;
if (weakSelf.zanBtn.selected) {
[weakSelf.zanBtn setTitle:[NSString stringWithFormat:@"%ld", weakSelf.model.like_num.integerValue+1] forState:UIControlStateNormal];
}else{
[weakSelf.zanBtn setTitle:[NSString stringWithFormat:@"%ld", weakSelf.model.like_num.integerValue] forState:UIControlStateNormal];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
- (IBAction)onHomepage:(id)sender {
if (self.cellType == QXDynamicListCellHomePage) {
return;
}
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
vc.user_id = self.model.user_id;
[self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)onMore:(id)sender {
QXShareView *shareView = [[QXShareView alloc] init];
shareView.shareType = QXShareViewTypeFind;
shareView.delegate = self;
shareView.dynamicModel = self.model;
[shareView showInView:KEYWINDOW];
}
- (IBAction)likeViewAction:(id)sender {
QXDynamicLikeListView *listView = [[QXDynamicLikeListView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
listView.Id = self.model.id;
listView.num = [NSString localizedStringWithFormat:QXText(@"已有%@人点赞"),self.zanBtn.titleLabel.text];
[listView showInView:KEYWINDOW];
}
-(void)didClickShareModel:(QXShareViewModel *)model{
if ([model.name isEqualToString:QXText(@"删除")]) {
MJWeakSelf
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
al.type = QXAlertViewTypeDeleteDynamic;
al.commitBlock = ^{
[weakSelf deleteDynamic];
};
[[QXGlobal shareGlobal] showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
}else if ([model.name isEqualToString:QXText(@"复制链接")]) {
UIPasteboard *p = [UIPasteboard generalPasteboard];
p.string = [NSString stringWithFormat:@"%@", self.model.share_url];
showToast(@"复制成功");
}else if ([model.name isEqualToString:QXText(@"举报")]) {
QXReportViewController *reportVC = [[QXReportViewController alloc] init];
reportVC.reportType = @"3";
reportVC.fromId = self.model.id;
[self.navigationController pushViewController:reportVC animated:YES];
}
}
-(void)deleteDynamic{
MJWeakSelf
[QXDynamicNetwork deleteDynamicWithId:self.model.id successBlock:^(NSDictionary * _Nonnull dict) {
if (weakSelf.onDeleteBlock) {
weakSelf.onDeleteBlock(weakSelf.model);
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)onReport {
// SPTrendReportVC *vc = [[SPTrendReportVC alloc] init];
// vc.userId = self.model.uid;
// [vc pushSelf];
}
- (IBAction)giveAction:(id)sender {
// QXAlertViewController *al = [[QXAlertViewController alloc] init];
// al.alertView = sendView;
// al.tapDismiss = YES;
// al.popType = PopViewTypeBottomToUpActionSheet;
// self.sendView.vc = self.viewController;
self.sendView.dynamicId = self.model.id;
MJWeakSelf
self.sendView.sendSuccessBlock = ^(NSString * _Nonnull dynamicId) {
[weakSelf reloadDetail];
[weakSelf.sendView hide];
self->_sendView = nil;
};
[self.sendView showInView:KEYWINDOW];
// al.modalPresentationStyle = UIModalPresentationOverFullScreen;
// [self.viewController presentViewController:al animated:NO completion:nil];
}
-(void)reloadDetail{
MJWeakSelf
[QXDynamicNetwork dynamicPageWithId:self.model.id successBlock:^(QXDynamicModel * _Nonnull model) {
weakSelf.model = model;
[weakSelf setModel:model];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)setBtnTypeWithIsFollow:(BOOL)isFollow{
[self.focusBtn setTitle:isFollow?QXText(@"跟随"):QXText(@"私信") forState:(UIControlStateNormal)];
[self.focusBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
self.focusBtn.backgroundColor = RGB16(0x333333);
self.focusBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.focusBtn addRoundedCornersWithRadius:12.5];
}
-(QXSendGiftView *)sendView{
if (!_sendView) {
_sendView = [[QXSendGiftView alloc] initWithType:(QXSendGiftViewTypeFind)];
// QXAlertViewController *al = [[QXAlertViewController alloc] init];
// al.alertView = sendView;
// al.tapDismiss = YES;
// al.popType = PopViewTypeBottomToUpActionSheet;
[_sendView reloadData];
}
return _sendView;
}
@end

View File

@@ -0,0 +1,345 @@
<?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" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<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="235" id="KGk-i7-Jjw" customClass="QXDynamicListCell">
<rect key="frame" x="0.0" y="0.0" width="436" height="152"/>
<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="436" height="152"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FEa-6s-S1q">
<rect key="frame" x="16" y="6" width="404" height="140"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="iFl-Jk-YzR">
<rect key="frame" x="12" y="12" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="8Ho-cM-60x"/>
<constraint firstAttribute="height" constant="50" id="h0K-eb-9YA"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="25"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vk2-bh-wsO" customClass="QXSeatHeaderView">
<rect key="frame" x="12" y="12" width="50" height="50"/>
</view>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="nKt-dS-UFi">
<rect key="frame" x="46" y="46" width="16" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="LAw-FW-P22"/>
<constraint firstAttribute="width" constant="16" id="Rnl-1o-McO"/>
</constraints>
</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="gzL-1m-sSx">
<rect key="frame" x="72" y="19" width="40" height="18"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="slU-4Q-xRo">
<rect key="frame" x="118" y="20.5" width="15" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="OBm-DF-7Rk"/>
<constraint firstAttribute="width" constant="15" id="vaN-Ip-2ve"/>
</constraints>
</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="s4f-xe-cfP">
<rect key="frame" x="72" y="45" width="31.5" height="14.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XGd-g3-CJu">
<rect key="frame" x="12" y="74" width="380" height="11"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xKO-5c-aaJ">
<rect key="frame" x="12" y="96" width="380" height="0.0"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" id="pz4-85-F5Q"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0i8-vW-sax">
<rect key="frame" x="0.0" y="96" width="404" height="44"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EKa-4e-K1g">
<rect key="frame" x="172" y="7" width="70" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="V3Y-g1-oI6"/>
<constraint firstAttribute="height" constant="30" id="dgb-HX-3qu"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="5" maxY="0.0"/>
<state key="normal" title="0" image="dynamic_comment">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="commentAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="KTj-Zd-Dnp"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S5y-fG-SnS">
<rect key="frame" x="247" y="8" width="70" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="Eev-1U-blc"/>
<constraint firstAttribute="width" constant="70" id="JXW-ug-osW"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
<inset key="imageEdgeInsets" minX="0.0" minY="2" maxX="5" maxY="0.0"/>
<state key="normal" title="0" image="dynamic_like">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="selected" image="dynamic_like_sel">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="onZan:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="bEY-DV-IGu"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jjl-ep-Ior">
<rect key="frame" x="322" y="7" width="70" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="6Uo-qy-hOs"/>
<constraint firstAttribute="width" constant="70" id="pcM-Th-kf6"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
<inset key="imageEdgeInsets" minX="0.0" minY="2" maxX="5" maxY="0.0"/>
<state key="normal" title="0" image="dynamic_give">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="selected" image="trend_zan_sel">
<color key="titleColor" red="0.57254901960000004" green="0.28627450980000002" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="giveAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="81t-bQ-N6F"/>
</connections>
</button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="rSB-IC-yLc">
<rect key="frame" x="12" y="15" width="14" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="14" id="Ljn-Kf-utR"/>
<constraint firstAttribute="height" constant="14" id="p75-do-YHv"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="7"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jZt-T7-Wn2">
<rect key="frame" x="21" y="15" width="14" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="OcC-ac-TLM"/>
<constraint firstAttribute="width" constant="14" id="PYK-z6-0qB"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="7"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mgq-EX-fSI">
<rect key="frame" x="30" y="15" width="14" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="14" id="Oyp-Lt-cfG"/>
<constraint firstAttribute="height" constant="14" id="yeO-Qa-e2X"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="7"/>
</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="SkL-b5-rlj">
<rect key="frame" x="47" y="15" width="120" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<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" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Avw-XH-qrb">
<rect key="frame" x="12" y="4.5" width="155" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="35" id="erH-l2-lcl"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<connections>
<action selector="likeViewAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="ZTN-ot-yW2"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="jZt-T7-Wn2" firstAttribute="leading" secondItem="rSB-IC-yLc" secondAttribute="trailing" constant="-5" id="2Ib-Dy-i17"/>
<constraint firstItem="Jjl-ep-Ior" firstAttribute="centerY" secondItem="0i8-vW-sax" secondAttribute="centerY" id="4f7-N6-bwy"/>
<constraint firstItem="SkL-b5-rlj" firstAttribute="centerY" secondItem="rSB-IC-yLc" secondAttribute="centerY" id="9dX-bU-0tW"/>
<constraint firstItem="mgq-EX-fSI" firstAttribute="top" secondItem="rSB-IC-yLc" secondAttribute="top" id="CGL-dM-rHg"/>
<constraint firstItem="SkL-b5-rlj" firstAttribute="leading" secondItem="mgq-EX-fSI" secondAttribute="trailing" constant="3" id="JRF-TW-TOd"/>
<constraint firstItem="S5y-fG-SnS" firstAttribute="centerY" secondItem="0i8-vW-sax" secondAttribute="centerY" constant="1" id="O7I-Td-ldi"/>
<constraint firstItem="mgq-EX-fSI" firstAttribute="leading" secondItem="jZt-T7-Wn2" secondAttribute="trailing" constant="-5" id="P30-wH-iQV"/>
<constraint firstItem="Avw-XH-qrb" firstAttribute="centerY" secondItem="rSB-IC-yLc" secondAttribute="centerY" id="PJy-0P-XVJ"/>
<constraint firstItem="S5y-fG-SnS" firstAttribute="leading" secondItem="EKa-4e-K1g" secondAttribute="trailing" constant="5" id="PzI-EM-1dk"/>
<constraint firstItem="jZt-T7-Wn2" firstAttribute="top" secondItem="rSB-IC-yLc" secondAttribute="top" id="Spz-Uu-qba"/>
<constraint firstItem="Avw-XH-qrb" firstAttribute="leading" secondItem="rSB-IC-yLc" secondAttribute="leading" id="UcG-Dj-JzT"/>
<constraint firstItem="Jjl-ep-Ior" firstAttribute="leading" secondItem="S5y-fG-SnS" secondAttribute="trailing" constant="5" id="ZiO-Ov-lfy"/>
<constraint firstAttribute="height" constant="44" id="aJZ-Tj-Bff"/>
<constraint firstItem="Avw-XH-qrb" firstAttribute="trailing" secondItem="SkL-b5-rlj" secondAttribute="trailing" id="c9I-mq-qTD"/>
<constraint firstItem="EKa-4e-K1g" firstAttribute="leading" secondItem="SkL-b5-rlj" secondAttribute="trailing" constant="5" id="ktO-7i-Qrp"/>
<constraint firstItem="rSB-IC-yLc" firstAttribute="centerY" secondItem="Jjl-ep-Ior" secondAttribute="centerY" id="og5-QO-H9q"/>
<constraint firstAttribute="trailing" secondItem="Jjl-ep-Ior" secondAttribute="trailing" constant="12" id="q5A-pu-iWj"/>
<constraint firstItem="EKa-4e-K1g" firstAttribute="centerY" secondItem="0i8-vW-sax" secondAttribute="centerY" id="qBQ-fz-vcY"/>
<constraint firstItem="rSB-IC-yLc" firstAttribute="leading" secondItem="0i8-vW-sax" secondAttribute="leading" constant="12" id="vTi-ga-8P8"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XnQ-EM-4IC">
<rect key="frame" x="12" y="12" width="100" height="50"/>
<connections>
<action selector="onHomepage:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="H3O-BM-n0k"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jzI-eZ-gdm">
<rect key="frame" x="362" y="0.0" width="40" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="jOd-F8-n6l"/>
<constraint firstAttribute="width" constant="40" id="vEP-wn-0YJ"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="dynamic_more"/>
<connections>
<action selector="onMore:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="ljO-t9-GAH"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="80W-MV-Snb">
<rect key="frame" x="0.0" y="140" width="404" height="0.0"/>
<color key="backgroundColor" white="0.0" alpha="0.049149908987032316" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" id="Okg-di-KRQ"/>
</constraints>
</view>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KBv-qN-JAr">
<rect key="frame" x="287" y="12.5" width="70" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="JXr-Sj-Gnx"/>
<constraint firstAttribute="width" constant="70" id="sja-gQ-iRl"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="selected" image="trend_focus_sel">
<color key="titleColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.59607843137254901" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="onFocus:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="j6Y-rX-j41"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="vk2-bh-wsO" firstAttribute="top" secondItem="iFl-Jk-YzR" secondAttribute="top" id="0s9-8o-8YE"/>
<constraint firstItem="XnQ-EM-4IC" firstAttribute="bottom" secondItem="iFl-Jk-YzR" secondAttribute="bottom" id="2ac-w2-BKA"/>
<constraint firstItem="s4f-xe-cfP" firstAttribute="leading" secondItem="gzL-1m-sSx" secondAttribute="leading" id="38p-VS-qLr"/>
<constraint firstAttribute="bottom" secondItem="80W-MV-Snb" secondAttribute="bottom" id="3h2-58-lfe"/>
<constraint firstItem="jzI-eZ-gdm" firstAttribute="top" secondItem="FEa-6s-S1q" secondAttribute="top" id="89I-UH-pXs"/>
<constraint firstAttribute="trailing" secondItem="jzI-eZ-gdm" secondAttribute="trailing" constant="2" id="Cme-Hw-cqe"/>
<constraint firstItem="0i8-vW-sax" firstAttribute="leading" secondItem="FEa-6s-S1q" secondAttribute="leading" id="F8G-QN-wtB"/>
<constraint firstItem="XnQ-EM-4IC" firstAttribute="leading" secondItem="iFl-Jk-YzR" secondAttribute="leading" id="Hgn-gx-xME"/>
<constraint firstAttribute="trailing" secondItem="0i8-vW-sax" secondAttribute="trailing" id="LDf-pd-BxE"/>
<constraint firstItem="nKt-dS-UFi" firstAttribute="bottom" secondItem="vk2-bh-wsO" secondAttribute="bottom" id="Nja-UU-BcF"/>
<constraint firstItem="vk2-bh-wsO" firstAttribute="leading" secondItem="iFl-Jk-YzR" secondAttribute="leading" id="P2L-Sd-ymb"/>
<constraint firstItem="gzL-1m-sSx" firstAttribute="leading" secondItem="iFl-Jk-YzR" secondAttribute="trailing" constant="10" id="Pxx-kz-iUB"/>
<constraint firstItem="XnQ-EM-4IC" firstAttribute="trailing" secondItem="gzL-1m-sSx" secondAttribute="trailing" id="RZH-11-ZZs"/>
<constraint firstItem="iFl-Jk-YzR" firstAttribute="leading" secondItem="FEa-6s-S1q" secondAttribute="leading" constant="12" id="S1l-dI-KHD"/>
<constraint firstItem="gzL-1m-sSx" firstAttribute="top" secondItem="iFl-Jk-YzR" secondAttribute="top" constant="7" id="VC5-4G-7Gw"/>
<constraint firstItem="iFl-Jk-YzR" firstAttribute="top" secondItem="FEa-6s-S1q" secondAttribute="top" constant="12" id="Vjt-qY-whB"/>
<constraint firstItem="0i8-vW-sax" firstAttribute="top" secondItem="xKO-5c-aaJ" secondAttribute="bottom" id="WDL-Wr-cuB"/>
<constraint firstAttribute="bottom" secondItem="0i8-vW-sax" secondAttribute="bottom" id="Xon-6v-maS"/>
<constraint firstItem="XGd-g3-CJu" firstAttribute="leading" secondItem="FEa-6s-S1q" secondAttribute="leading" constant="12" id="bKS-fP-sXh"/>
<constraint firstItem="XnQ-EM-4IC" firstAttribute="top" secondItem="iFl-Jk-YzR" secondAttribute="top" id="dMG-bF-Wg3"/>
<constraint firstItem="KBv-qN-JAr" firstAttribute="centerY" secondItem="jzI-eZ-gdm" secondAttribute="centerY" id="dcA-w8-qQN"/>
<constraint firstItem="XGd-g3-CJu" firstAttribute="top" secondItem="iFl-Jk-YzR" secondAttribute="bottom" constant="12" id="eEd-f0-9fK"/>
<constraint firstItem="xKO-5c-aaJ" firstAttribute="leading" secondItem="XGd-g3-CJu" secondAttribute="leading" id="fLw-df-ckN"/>
<constraint firstItem="slU-4Q-xRo" firstAttribute="leading" secondItem="gzL-1m-sSx" secondAttribute="trailing" constant="6" id="g49-EX-wEM"/>
<constraint firstItem="vk2-bh-wsO" firstAttribute="bottom" secondItem="iFl-Jk-YzR" secondAttribute="bottom" id="hsd-6k-jET"/>
<constraint firstItem="xKO-5c-aaJ" firstAttribute="top" secondItem="XGd-g3-CJu" secondAttribute="bottom" constant="11" id="j8o-e5-R6g"/>
<constraint firstAttribute="trailing" secondItem="80W-MV-Snb" secondAttribute="trailing" id="jB9-yk-qTN"/>
<constraint firstItem="s4f-xe-cfP" firstAttribute="top" secondItem="gzL-1m-sSx" secondAttribute="bottom" constant="8" id="jff-zj-ite"/>
<constraint firstItem="80W-MV-Snb" firstAttribute="leading" secondItem="FEa-6s-S1q" secondAttribute="leading" id="jnc-2p-hcR"/>
<constraint firstItem="jzI-eZ-gdm" firstAttribute="leading" secondItem="KBv-qN-JAr" secondAttribute="trailing" constant="5" id="kv0-Li-FDy"/>
<constraint firstItem="nKt-dS-UFi" firstAttribute="trailing" secondItem="vk2-bh-wsO" secondAttribute="trailing" id="nVC-Xf-S6M"/>
<constraint firstItem="slU-4Q-xRo" firstAttribute="centerY" secondItem="gzL-1m-sSx" secondAttribute="centerY" id="p8d-jw-X6X"/>
<constraint firstAttribute="trailing" secondItem="XGd-g3-CJu" secondAttribute="trailing" constant="12" id="sMu-dZ-CIe"/>
<constraint firstItem="vk2-bh-wsO" firstAttribute="trailing" secondItem="iFl-Jk-YzR" secondAttribute="trailing" id="sYt-vO-dxf"/>
<constraint firstItem="xKO-5c-aaJ" firstAttribute="trailing" secondItem="XGd-g3-CJu" secondAttribute="trailing" id="ufS-2M-IcL"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="16"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<constraints>
<constraint firstItem="FEa-6s-S1q" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="3Vj-wd-HM3"/>
<constraint firstAttribute="bottom" secondItem="FEa-6s-S1q" secondAttribute="bottom" constant="6" id="716-YN-jJw"/>
<constraint firstItem="FEa-6s-S1q" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="U2e-RQ-yQk"/>
<constraint firstAttribute="trailing" secondItem="FEa-6s-S1q" secondAttribute="trailing" constant="16" id="p42-QY-zTx"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="avatarImgV" destination="vk2-bh-wsO" id="PCS-cN-uVM"/>
<outlet property="bgLeftCon" destination="3Vj-wd-HM3" id="Bsh-cK-7Tu"/>
<outlet property="bgRightCon" destination="p42-QY-zTx" id="osh-v4-oXG"/>
<outlet property="bgView" destination="FEa-6s-S1q" id="aia-HE-ZZo"/>
<outlet property="commentBtn" destination="EKa-4e-K1g" id="RUU-d2-9X4"/>
<outlet property="contentLab" destination="XGd-g3-CJu" id="79N-et-e2R"/>
<outlet property="focusBtn" destination="KBv-qN-JAr" id="6hu-Wt-CaW"/>
<outlet property="giveBtn" destination="Jjl-ep-Ior" id="zSP-AO-2Li"/>
<outlet property="imgsBgView" destination="xKO-5c-aaJ" id="i8U-8p-HAZ"/>
<outlet property="imgsBgViewHeightCon" destination="pz4-85-F5Q" id="BVd-Eq-IRQ"/>
<outlet property="likeCountLabel" destination="SkL-b5-rlj" id="SCq-dQ-i87"/>
<outlet property="likeViewBtn" destination="Avw-XH-qrb" id="TrC-Wd-RVW"/>
<outlet property="nicknameLab" destination="gzL-1m-sSx" id="mJS-uW-MuX"/>
<outlet property="sexImageView" destination="nKt-dS-UFi" id="uXD-tN-GaU"/>
<outlet property="sexImgV" destination="slU-4Q-xRo" id="fsh-v7-Cfd"/>
<outlet property="timeLab" destination="s4f-xe-cfP" id="d77-Je-mK5"/>
<outlet property="userImageView1" destination="rSB-IC-yLc" id="zg2-hF-dBP"/>
<outlet property="userImageView2" destination="jZt-T7-Wn2" id="uY6-kc-xWg"/>
<outlet property="userImageView3" destination="mgq-EX-fSI" id="9A7-1p-619"/>
<outlet property="zanBtn" destination="S5y-fG-SnS" id="Kq5-GZ-FlA"/>
</connections>
<point key="canvasLocation" x="263.768115942029" y="150"/>
</tableViewCell>
</objects>
<resources>
<image name="dynamic_comment" width="24" height="24"/>
<image name="dynamic_give" width="24" height="24"/>
<image name="dynamic_like" width="24" height="24"/>
<image name="dynamic_like_sel" width="24" height="24"/>
<image name="dynamic_more" width="24" height="24"/>
<image name="trend_focus_sel" width="59" height="28"/>
<image name="trend_zan_sel" width="24" height="24"/>
</resources>
</document>

View File

@@ -0,0 +1,20 @@
//
// QXDynamicTopicCell.h
// QXLive
//
// Created by 启星 on 2025/5/9.
//
#import <UIKit/UIKit.h>
#import "QXDynamicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXDynamicTopicCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *topicImageView;
@property (weak, nonatomic) IBOutlet UIImageView *tagImageView;
@property (weak, nonatomic) IBOutlet UILabel *countLabel;
@property (nonatomic,strong)QXTopicModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,22 @@
//
// QXDynamicTopicCell.m
// QXLive
//
// Created by on 2025/5/9.
//
#import "QXDynamicTopicCell.h"
#import "NSString+QX.h"
@implementation QXDynamicTopicCell
-(void)setModel:(QXTopicModel *)model{
[self.topicImageView sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:nil];
self.titleLabel.text = model.title;
self.countLabel.text = [NSString localizedStringWithFormat:QXText(@"%@条动态"),[NSString qx_showHotCountNum:model.count.longLongValue]];
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
@end

View File

@@ -0,0 +1,82 @@
<?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"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="QXDynamicTopicCell">
<rect key="frame" x="0.0" y="0.0" width="260" height="45"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="260" height="45"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="VZ2-zn-s54">
<rect key="frame" x="0.0" y="0.0" width="45" height="45"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" secondItem="VZ2-zn-s54" secondAttribute="height" multiplier="1:1" id="3ik-gC-t5O"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</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="VEs-QB-WWq">
<rect key="frame" x="52" y="0.0" width="78" height="20"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dynamic_topic_tag" translatesAutoresizingMaskIntoConstraints="NO" id="RtE-EB-lWr">
<rect key="frame" x="52" y="30" width="37" height="13"/>
<constraints>
<constraint firstAttribute="width" constant="37" id="4j6-sN-hql"/>
<constraint firstAttribute="height" constant="13" id="WTr-P2-WQj"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2.92w条动态" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rTU-7J-yig">
<rect key="frame" x="93" y="26.666666666666671" width="72" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="VBn-jM-uVT"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
<viewLayoutGuide key="safeArea" id="SEy-5g-ep8"/>
<constraints>
<constraint firstItem="VZ2-zn-s54" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="Esx-wY-aRk"/>
<constraint firstItem="VEs-QB-WWq" firstAttribute="leading" secondItem="VZ2-zn-s54" secondAttribute="trailing" constant="7" id="Flk-Se-GPC"/>
<constraint firstItem="RtE-EB-lWr" firstAttribute="leading" secondItem="VZ2-zn-s54" secondAttribute="trailing" constant="7" id="H4i-fy-dPr"/>
<constraint firstAttribute="bottom" secondItem="VZ2-zn-s54" secondAttribute="bottom" id="WvW-oS-6y5"/>
<constraint firstItem="VEs-QB-WWq" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="XCm-kM-T5b"/>
<constraint firstItem="VZ2-zn-s54" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="gtA-uD-jZS"/>
<constraint firstItem="rTU-7J-yig" firstAttribute="centerY" secondItem="RtE-EB-lWr" secondAttribute="centerY" id="jIt-Hm-jNG"/>
<constraint firstAttribute="bottom" secondItem="RtE-EB-lWr" secondAttribute="bottom" constant="2" id="yw1-IM-rGt"/>
<constraint firstItem="rTU-7J-yig" firstAttribute="leading" secondItem="RtE-EB-lWr" secondAttribute="trailing" constant="4" id="z97-ri-2VL"/>
</constraints>
<size key="customSize" width="439" height="156"/>
<connections>
<outlet property="countLabel" destination="rTU-7J-yig" id="ocw-kQ-niu"/>
<outlet property="tagImageView" destination="RtE-EB-lWr" id="851-cF-Stg"/>
<outlet property="titleLabel" destination="VEs-QB-WWq" id="c9M-Vu-nfH"/>
<outlet property="topicImageView" destination="VZ2-zn-s54" id="LjS-Jk-r2L"/>
</connections>
<point key="canvasLocation" x="435.87786259541986" y="57.04225352112676"/>
</collectionViewCell>
</objects>
<resources>
<image name="dynamic_topic_tag" width="37" height="13"/>
</resources>
</document>

View File

@@ -0,0 +1,28 @@
//
// QXExpansionAppStoreView.h
// QXLive
//
// Created by 启星 on 2025/7/31.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXExpansionAppStoreView : UIView
@property (nonatomic,strong)NSArray<QXUserHomeModel*> *users;
@property (nonatomic,copy)void(^userBlock)(QXUserHomeModel*user);
@end
@interface QXExpansionAppStoreSubView : UIView
@property(nonatomic,strong)UIImageView *headerImageView;
@property(nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UIImageView *sexImageView;
@property(nonatomic,strong)QXUserHomeModel *model;
- (void)startSmoothFloatAnimation ;
- (void)stopFloatAnimation ;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,379 @@
//
// QXExpansionAppStoreView.m
// QXLive
//
// Created by on 2025/7/31.
//
#import "QXExpansionAppStoreView.h"
#import "CKShimmerLabel.h"
@interface QXExpansionAppStoreView()<CAAnimationDelegate>
@property (nonatomic,strong)CKShimmerLabel *titleLabel;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *fengcheImageView;
@property (nonatomic,strong)UIButton *changeBtn;
@property (nonatomic,strong)NSMutableArray *randomArray;
@property (nonatomic,strong)QXExpansionAppStoreSubView *userView1;
@property (nonatomic,strong)QXExpansionAppStoreSubView *userView2;
@property (nonatomic,strong)QXExpansionAppStoreSubView *userView3;
@property (nonatomic,strong)QXExpansionAppStoreSubView *userView4;
@property (nonatomic,strong)NSMutableArray *userViews;
@end
@implementation QXExpansionAppStoreView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
UIView *hitView= [super hitTest:point withEvent:event];
if (hitView== self)
{
return nil;
}
else
{
return hitView;
}
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"expansion_bg"]];
self.bgImageView.frame = CGRectMake((self.width-375)/2, (self.height-375)/2-20, 375, 375);
[self addSubview:self.bgImageView];
// [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.height.width.mas_equalTo(375);
// make.centerX.centerY.equalTo(self);
// }];
self.titleLabel = [[CKShimmerLabel alloc] init];
self.titleLabel.shimmerWidth = 20;
self.titleLabel.shimmerRadius = 20;
self.titleLabel.shimmerColor = QXConfig.themeColor;
self.titleLabel.shimmerType = ST_LeftToRight;
self.titleLabel.repeat = YES;
self.titleLabel.textColor = RGB16(0x333333);
self.titleLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:30];
self.titleLabel.text = @"风车转转转,找寻新玩伴";
self.titleLabel.top = 80;
[self.titleLabel.contentLabel sizeToFit];
self.titleLabel.width = self.titleLabel.contentLabel.width;
self.titleLabel.centerX = self.centerX;
[self.titleLabel startShimmer];
[self addSubview:self.titleLabel];
self.fengcheImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"fengche"]];
self.fengcheImageView.hidden = YES;
self.fengcheImageView.frame = CGRectMake((self.width-70)/2, (self.height-70)/2-20, 70, 70);
[self.fengcheImageView addRoundedCornersWithRadius:35];
self.fengcheImageView.layer.borderWidth = 5;
self.fengcheImageView.layer.borderColor = UIColor.whiteColor.CGColor;
[self addSubview:self.fengcheImageView];
// [self.fengcheImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.centerY.centerX.equalTo(self.bgImageView);
// make.height.width.mas_offset(70);
// }];
self.changeBtn = [[UIButton alloc] init];
self.changeBtn.frame = self.fengcheImageView.frame;
self.changeBtn.backgroundColor = QXConfig.themeColor;
[self.changeBtn addRoundedCornersWithRadius:35];
[self.changeBtn setTitle:@"换一批" forState:(UIControlStateNormal)];
self.changeBtn.layer.borderWidth = 5;
self.changeBtn.layer.borderColor = UIColor.whiteColor.CGColor;
self.changeBtn.titleLabel.font = [UIFont systemFontOfSize:15];
[self.changeBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
[self.changeBtn addTarget:self action:@selector(changeAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.changeBtn];
// [self.changeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.centerY.centerX.equalTo(self.bgImageView);
// make.height.width.mas_offset(70);
// }];
self.userView1 = [[QXExpansionAppStoreSubView alloc] initWithFrame:CGRectMake(self.bgImageView.left+40, self.bgImageView.top+28, 100, 100)];
[self addSubview:self.userView1];
// [self.userView1 mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.bgImageView).offset(40);
// make.top.equalTo(self.bgImageView).offset(32);
// make.width.mas_equalTo(100);
// make.height.mas_equalTo(100);
// }];
self.userView2 = [[QXExpansionAppStoreSubView alloc] initWithFrame:CGRectMake(self.bgImageView.right-40-100, self.bgImageView.top+28, 100, 100)];
[self addSubview:self.userView2];
// [self.userView2 mas_makeConstraints:^(MASConstraintMaker *make) {
// make.right.equalTo(self.bgImageView).offset(-40);
// make.top.equalTo(self.bgImageView).offset(32);
// make.width.mas_equalTo(100);
// make.height.mas_equalTo(100);
// }];
self.userView3 = [[QXExpansionAppStoreSubView alloc] initWithFrame:CGRectMake(self.bgImageView.left+40, self.bgImageView.bottom-55-100, 100, 100)];
[self addSubview:self.userView3];
// [self.userView3 mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.bgImageView).offset(40);
// make.bottom.equalTo(self.bgImageView).offset(-55);
// make.width.mas_equalTo(100);
// make.height.mas_equalTo(100);
// }];
self.userView4 = [[QXExpansionAppStoreSubView alloc] initWithFrame:CGRectMake(self.bgImageView.right-40-100, self.bgImageView.bottom-55-100, 100, 100)];
[self addSubview:self.userView4];
// [self.userView4 mas_makeConstraints:^(MASConstraintMaker *make) {
// make.right.equalTo(self.bgImageView).offset(-40);
// make.bottom.equalTo(self.bgImageView).offset(-55);
// make.width.mas_equalTo(100);
// make.height.mas_equalTo(100);
// }];
[self.userViews addObject:self.userView1];
[self.userViews addObject:self.userView2];
[self.userViews addObject:self.userView3];
[self.userViews addObject:self.userView4];
MJWeakSelf
[self.userView1 addTapBlock:^(id _Nonnull obj) {
if (weakSelf.userBlock) {
weakSelf.userBlock(weakSelf.userView1.model);
}
}];
[self.userView2 addTapBlock:^(id _Nonnull obj) {
if (weakSelf.userBlock) {
weakSelf.userBlock(weakSelf.userView2.model);
}
}];
[self.userView3 addTapBlock:^(id _Nonnull obj) {
if (weakSelf.userBlock) {
weakSelf.userBlock(weakSelf.userView3.model);
}
}];
[self.userView4 addTapBlock:^(id _Nonnull obj) {
if (weakSelf.userBlock) {
weakSelf.userBlock(weakSelf.userView4.model);
}
}];
}
-(void)changeAction:(UIButton*)sender{
[self.userView1 stopFloatAnimation];
[self.userView2 stopFloatAnimation];
[self.userView3 stopFloatAnimation];
[self.userView4 stopFloatAnimation];
self.fengcheImageView.alpha = 0;
self.fengcheImageView.hidden = NO;
[UIView animateWithDuration:0.3 animations:^{
self.changeBtn.alpha = 0;
self.fengcheImageView.alpha = 1;
self.userView1.centerX = self.bgImageView.centerX;
self.userView1.centerY = self.bgImageView.centerY;
self.userView2.centerX = self.bgImageView.centerX;
self.userView2.centerY = self.bgImageView.centerY;
self.userView3.centerX = self.bgImageView.centerX;
self.userView3.centerY = self.bgImageView.centerY;
self.userView4.centerX = self.bgImageView.centerX;
self.userView4.centerY = self.bgImageView.centerY;
self.userView1.alpha = 0;
self.userView2.alpha = 0;
self.userView3.alpha = 0;
self.userView4.alpha = 0;
} completion:^(BOOL finished) {
self.changeBtn.hidden = YES;
[self fengchezhuan];
}];
}
-(void)fengchezhuan{
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
//
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
//
rotationAnimation.duration = 0.2;
// rotationAnimation.repeatCount = 15;
rotationAnimation.delegate = self;
rotationAnimation.cumulative = YES;
rotationAnimation.removedOnCompletion = NO;
//MAXFLOAT
rotationAnimation.repeatCount = 8;
[self.fengcheImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
self.changeBtn.alpha = 0;
self.changeBtn.hidden = NO;
self.fengcheImageView.hidden = YES;
[self configData];
[UIView animateWithDuration:0.3 animations:^{
self.changeBtn.alpha = 1;
self.userView1.frame = CGRectMake(self.bgImageView.left+40, self.bgImageView.top+28, 100, 100);
self.userView2.frame = CGRectMake(self.bgImageView.right-40-100, self.bgImageView.top+28, 100, 100);
self.userView3.frame = CGRectMake(self.bgImageView.left+40, self.bgImageView.bottom-55-100, 100, 100);
self.userView4.frame = CGRectMake(self.bgImageView.right-40-100, self.bgImageView.bottom-55-100, 100, 100);
self.userView1.alpha = 1;
self.userView2.alpha = 1;
self.userView3.alpha = 1;
self.userView4.alpha = 1;
} completion:^(BOOL finished) {
[self.userView1 startSmoothFloatAnimation];
[self.userView2 startSmoothFloatAnimation];
[self.userView3 startSmoothFloatAnimation];
[self.userView4 startSmoothFloatAnimation];
}];
}
-(void)setUsers:(NSArray *)users{
_users = users;
[self changeAction:self.changeBtn];
}
-(void)configData{
[self.randomArray removeAllObjects];
if (_users.count <= 4) {
[self.randomArray addObjectsFromArray:self.users];
}else{
NSArray *rArr = [self optimizedRandomFourNumbers];
for (NSNumber *number in rArr) {
[self.randomArray addObject:self.users[number.integerValue]];
}
}
for (int i = 0 ; i < self.randomArray.count;i++) {
QXUserHomeModel *md = self.randomArray[i];
QXExpansionAppStoreSubView *v = self.userViews[i];
v.model = md;
}
}
- (NSArray *)optimizedRandomFourNumbers {
NSMutableArray *allNumbers = [NSMutableArray arrayWithCapacity:self.users.count-1];
for (int i = 1; i < self.users.count; i++) {
[allNumbers addObject:@(i)];
}
NSMutableArray *result = [NSMutableArray arrayWithCapacity:4];
for (int i = 0; i < 4; i++) {
int remainingCount = (int)allNumbers.count;
int randomIndex = arc4random_uniform(remainingCount);
[result addObject:allNumbers[randomIndex]];
[allNumbers removeObjectAtIndex:randomIndex];
}
return result;
}
-(NSMutableArray *)randomArray{
if (!_randomArray) {
_randomArray = [NSMutableArray array];
}
return _randomArray;
}
-(NSMutableArray *)userViews{
if (!_userViews) {
_userViews = [NSMutableArray array];
}
return _userViews;
}
@end
@implementation QXExpansionAppStoreSubView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)setModel:(QXUserHomeModel *)model{
_model = model;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.nameLabel.text = model.nickname;
UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"];
self.sexImageView.image = sexImage;
}
-(void)initSubviews{
self.headerImageView = [[UIImageView alloc] init];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.headerImageView addRoundedCornersWithRadius:35];
// self.headerImageView.backgroundColor = [UIColor brownColor];;
[self addSubview:self.headerImageView];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.centerX.equalTo(self);
make.height.width.mas_offset(70);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0x333333);
self.nameLabel.font = [UIFont systemFontOfSize:14];
// self.nameLabel.text = @"张三";
[self addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.headerImageView.mas_bottom).offset(8);
make.centerX.equalTo(self);
make.height.mas_equalTo(20);
}];
self.sexImageView = [[UIImageView alloc] init];
[self addSubview:self.sexImageView];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.right.equalTo(self.headerImageView);
make.height.width.mas_offset(16);
}];
}
- (void)startSmoothFloatAnimation {
[self animateFloatUp];
}
- (void)animateFloatUp {
CGFloat floatDistance = 10.0f;
CGFloat duration = 2.0f;
[UIView animateWithDuration:duration
delay:0
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.transform = CGAffineTransformMakeTranslation(0, -floatDistance);
}
completion:^(BOOL finished) {
[self animateFloatDown];
}];
}
- (void)animateFloatDown {
CGFloat duration = 2.0f;
[UIView animateWithDuration:duration
delay:0
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.transform = CGAffineTransformIdentity;
}
completion:^(BOOL finished) {
[self animateFloatUp];
}];
}
- (void)stopFloatAnimation {
[self.layer removeAllAnimations];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
}
@end

View File

@@ -0,0 +1,27 @@
//
// QXExpansionCell.h
// QXLive
//
// Created by 启星 on 2025/5/27.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
#import "QXSeatHeaderView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXExpansionCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet QXSeatHeaderView *avatarImgV;
@property (weak, nonatomic) IBOutlet UILabel *nicknameLab;
@property (weak, nonatomic) IBOutlet UIImageView *levelImgV;
@property (weak, nonatomic) IBOutlet UILabel *ageLabel;
@property (weak, nonatomic) IBOutlet UIButton *followBtn;
@property (weak, nonatomic) IBOutlet UIView *imgsBgView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imgsBgViewHeightCon;
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
@property (nonatomic, strong) QXUserHomeModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,136 @@
//
// QXExpansionCell.m
// QXLive
//
// Created by on 2025/5/27.
//
#import "QXExpansionCell.h"
#import "YBImageBrowser.h"
#import "QXChatViewController.h"
@interface QXExpansionCell()
@property (nonatomic, strong) NSMutableArray *imgViewsArray;
@end
@implementation QXExpansionCell
- (void)createUI {
CGFloat imgWidth = (SCREEN_WIDTH-16*2-12*2-10*2)/3;
for (NSInteger i = 0; i < 6; i++) {
UIImageView *imgV = [[UIImageView alloc] init];
imgV.tag = i+100;
imgV.userInteractionEnabled = YES;
MJWeakSelf
[imgV addTapBlock:^(id _Nonnull obj) {
[weakSelf previewPhotoWithCurrentIndex:imgV.tag-100];
}];
imgV.hidden = YES;
imgV.layer.masksToBounds = YES;
imgV.layer.cornerRadius = 10;
imgV.contentMode = UIViewContentModeScaleAspectFill;
[self.imgsBgView addSubview:imgV];
[self.imgViewsArray addObject:imgV];
[imgV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.imgsBgView).offset((imgWidth+10)*(i/3));
make.left.equalTo(self.imgsBgView).offset((imgWidth+10)*(i%3));
make.size.mas_equalTo(CGSizeMake(imgWidth, imgWidth));
}];
}
}
- (IBAction)chatAction:(id)sender {
if (self.model.room_id.intValue > 0) {
//
[[QXGlobal shareGlobal] joinRoomWithRoomId:self.model.room_id isRejoin:NO navagationController:self.navigationController];
}else{
[[QXGlobal shareGlobal] chatWithUserID:self.model.user_id nickname:self.model.nickname avatar:self.model.avatar navagationController:self.navigationController];
}
}
-(void)setModel:(QXUserHomeModel *)model{
_model = model;
[self.avatarImgV setHeadIcon:model.avatar dress:@""];
self.nicknameLab.text = model.nickname;
self.ageLabel.text = [NSString stringWithFormat:@"%ld岁 ip属地: %@",[model.birthday ageWithDateOfBirth],model.loginip];
CGFloat imgWidth = (SCREEN_WIDTH-16*2-12*2-10*2)/3;
UIImageView *firstImgV = self.imgViewsArray.firstObject;
[firstImgV mas_updateConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(imgWidth, imgWidth));
}];
UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"];
self.sexImageView.image = sexImage;
NSArray *images;
if (model.home_bgimages.length > 0) {
images = [model.home_bgimages componentsSeparatedByString:@","];
}
for (UIImageView *imgV in self.imgViewsArray) {
imgV.hidden = YES;
}
for (NSInteger i = 0; i < images.count; i++) {
if (i < self.imgViewsArray.count) {
UIImageView *imgV = self.imgViewsArray[i];
imgV.hidden = NO;
NSString *imageUrl = images[i];
[imgV sd_setImageWithURL:[NSURL URLWithString:imageUrl]];
}
}
self.imgsBgView.hidden = YES;
if (images.count > 0) {
if (images.count == 1) {//
CGFloat itemW = (SCREEN_WIDTH-15-15-15)/2;
CGFloat imgBgHeight = itemW;
self.imgsBgView.hidden = NO;
self.imgsBgViewHeightCon.constant = imgBgHeight;
[firstImgV mas_updateConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(itemW, imgBgHeight));
}];
}else {
CGFloat itemW = (SCREEN_WIDTH-16*2-12*2-10*2)/3;
CGFloat imgBgHeight = 0;
NSInteger lines = images.count%3 == 0 ? images.count/3 : images.count/3+1;
imgBgHeight = itemW*lines + 10*(lines-1);
self.imgsBgView.hidden = NO;
if (images.count == 0) {
self.imgsBgViewHeightCon.constant = 0;
}else{
self.imgsBgViewHeightCon.constant = imgBgHeight;
}
}
}
if (self.model.room_id.intValue > 0) {
self.followBtn.selected = YES;
}else{
self.followBtn.selected = NO;
}
}
-(void)previewPhotoWithCurrentIndex:(NSInteger)currentIndex{
NSArray *images = [self.model.home_bgimages componentsSeparatedByString:@","];
YBImageBrowser *browser = [YBImageBrowser new];
NSMutableArray *sourceArray = [NSMutableArray array];
for (int i = 0 ; i <images.count;i++) {
NSString *url = images[i];
YBIBImageData *data = [[YBIBImageData alloc] init];
data.imageURL = [NSURL URLWithString:url];
UIImageView *imageView = [self viewWithTag:100+i];
data.projectiveView = imageView;
[sourceArray addObject:data];
}
browser.dataSourceArray = sourceArray;
browser.currentPage = currentIndex;
[browser show];
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.imgViewsArray = [NSMutableArray arrayWithCapacity:6];
[self createUI];
}
- (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,156 @@
<?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="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="184" id="BqF-kO-8SX" customClass="QXExpansionCell">
<rect key="frame" x="0.0" y="0.0" width="371" height="95"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="BqF-kO-8SX" id="ktB-xa-Y8j">
<rect key="frame" x="0.0" y="0.0" width="371" height="95"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d7u-yz-ciJ">
<rect key="frame" x="16" y="6" width="339" height="83"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ij8-0l-yjh">
<rect key="frame" x="12" y="12" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="Aa4-FN-u4i"/>
<constraint firstAttribute="width" constant="50" id="b1V-LD-cvU"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="25"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SRz-S8-eVY" customClass="QXSeatHeaderView">
<rect key="frame" x="12" y="12" width="50" height="50"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8cq-E3-DvJ">
<rect key="frame" x="72" y="19" width="40" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="qwD-PD-2sr"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="gIi-P2-Y9S">
<rect key="frame" x="118" y="20" width="42" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="42" id="Pa0-JD-WZI"/>
<constraint firstAttribute="height" constant="16" id="nev-GJ-TTd"/>
</constraints>
</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="SfJ-0f-fTV">
<rect key="frame" x="72" y="45" width="31.666666666666671" height="14.666666666666664"/>
<constraints>
<constraint firstAttribute="height" constant="14.67" id="ZBE-6b-COh"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="01B-he-W7N">
<rect key="frame" x="12" y="12" width="100" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</button>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WzX-5h-Rjx">
<rect key="frame" x="254" y="24" width="73" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="73" id="xrz-si-tcM"/>
<constraint firstAttribute="height" constant="26" id="zly-Ov-2fX"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" image="expansion_call">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="selected" image="room_user_follow">
<color key="titleColor" red="0.50196078430000002" green="0.50196078430000002" blue="0.59607843140000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="chatAction:" destination="BqF-kO-8SX" eventType="touchUpInside" id="1oh-Nh-GtV"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aff-rQ-ltL">
<rect key="frame" x="12" y="71" width="315" height="0.0"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" id="HM6-cc-JXk"/>
</constraints>
</view>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="rE2-Ub-cG3">
<rect key="frame" x="46" y="46" width="16" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="16" id="hDn-pN-Z1j"/>
<constraint firstAttribute="height" constant="16" id="txd-O6-q3p"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="SRz-S8-eVY" firstAttribute="top" secondItem="ij8-0l-yjh" secondAttribute="top" id="5SH-Nr-W30"/>
<constraint firstItem="SRz-S8-eVY" firstAttribute="leading" secondItem="ij8-0l-yjh" secondAttribute="leading" id="5xK-a1-AgP"/>
<constraint firstItem="aff-rQ-ltL" firstAttribute="leading" secondItem="d7u-yz-ciJ" secondAttribute="leading" constant="12" id="7W3-i0-a7h"/>
<constraint firstItem="ij8-0l-yjh" firstAttribute="top" secondItem="d7u-yz-ciJ" secondAttribute="top" constant="12" id="7rj-T2-7ef"/>
<constraint firstItem="gIi-P2-Y9S" firstAttribute="leading" secondItem="8cq-E3-DvJ" secondAttribute="trailing" constant="6" id="9a3-JM-DNn"/>
<constraint firstItem="SfJ-0f-fTV" firstAttribute="leading" secondItem="ij8-0l-yjh" secondAttribute="trailing" constant="10" id="LpR-OW-ApF"/>
<constraint firstItem="SRz-S8-eVY" firstAttribute="bottom" secondItem="ij8-0l-yjh" secondAttribute="bottom" id="PL9-sW-Etp"/>
<constraint firstItem="8cq-E3-DvJ" firstAttribute="top" secondItem="d7u-yz-ciJ" secondAttribute="top" constant="19" id="QB4-FR-hQC"/>
<constraint firstAttribute="trailing" secondItem="aff-rQ-ltL" secondAttribute="trailing" constant="12" id="UJy-KH-Me6"/>
<constraint firstItem="rE2-Ub-cG3" firstAttribute="trailing" secondItem="SRz-S8-eVY" secondAttribute="trailing" id="Us7-e2-feo"/>
<constraint firstItem="ij8-0l-yjh" firstAttribute="leading" secondItem="d7u-yz-ciJ" secondAttribute="leading" constant="12" id="VNZ-KS-lUT"/>
<constraint firstItem="rE2-Ub-cG3" firstAttribute="bottom" secondItem="SRz-S8-eVY" secondAttribute="bottom" id="Wkl-qB-guz"/>
<constraint firstItem="aff-rQ-ltL" firstAttribute="top" secondItem="ij8-0l-yjh" secondAttribute="bottom" constant="9" id="gpK-ex-dHB"/>
<constraint firstItem="WzX-5h-Rjx" firstAttribute="centerY" secondItem="ij8-0l-yjh" secondAttribute="centerY" id="lzk-gK-Xr5"/>
<constraint firstItem="SfJ-0f-fTV" firstAttribute="top" secondItem="8cq-E3-DvJ" secondAttribute="bottom" constant="8" symbolic="YES" id="pb7-FA-QT6"/>
<constraint firstItem="gIi-P2-Y9S" firstAttribute="centerY" secondItem="8cq-E3-DvJ" secondAttribute="centerY" id="qez-UP-KMH"/>
<constraint firstItem="SRz-S8-eVY" firstAttribute="trailing" secondItem="ij8-0l-yjh" secondAttribute="trailing" id="sL4-bA-4lX"/>
<constraint firstItem="8cq-E3-DvJ" firstAttribute="leading" secondItem="ij8-0l-yjh" secondAttribute="trailing" constant="10" id="xsB-a1-v4y"/>
<constraint firstAttribute="trailing" secondItem="WzX-5h-Rjx" secondAttribute="trailing" constant="12" id="yE0-Ql-MBm"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="16"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="d7u-yz-ciJ" secondAttribute="trailing" constant="16" id="ZEn-eg-5b1"/>
<constraint firstItem="d7u-yz-ciJ" firstAttribute="top" secondItem="ktB-xa-Y8j" secondAttribute="top" constant="6" id="c2h-ex-5ar"/>
<constraint firstItem="d7u-yz-ciJ" firstAttribute="leading" secondItem="ktB-xa-Y8j" secondAttribute="leading" constant="16" id="kQp-hc-1Ws"/>
<constraint firstAttribute="bottom" secondItem="d7u-yz-ciJ" secondAttribute="bottom" constant="6" id="qmb-ae-zTV"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="ageLabel" destination="SfJ-0f-fTV" id="sju-Ih-cv5"/>
<outlet property="avatarImgV" destination="SRz-S8-eVY" id="mLt-Oj-Jpd"/>
<outlet property="bgView" destination="d7u-yz-ciJ" id="xlK-4p-D30"/>
<outlet property="followBtn" destination="WzX-5h-Rjx" id="c7X-9W-ZDG"/>
<outlet property="imgsBgView" destination="aff-rQ-ltL" id="iQp-mS-jyp"/>
<outlet property="imgsBgViewHeightCon" destination="HM6-cc-JXk" id="rZb-Ea-rwx"/>
<outlet property="levelImgV" destination="gIi-P2-Y9S" id="74c-sq-nRX"/>
<outlet property="nicknameLab" destination="8cq-E3-DvJ" id="sfo-Gt-g93"/>
<outlet property="sexImageView" destination="rE2-Ub-cG3" id="zbU-Lq-BLy"/>
</connections>
<point key="canvasLocation" x="216.03053435114504" y="132.04225352112678"/>
</tableViewCell>
</objects>
<resources>
<image name="expansion_call" width="73" height="26"/>
<image name="room_user_follow" width="73" height="26"/>
</resources>
</document>

View File

@@ -0,0 +1,32 @@
//
// QXGiveGiftListView.h
// QXLive
//
// Created by 启星 on 2025/5/29.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXGiveGiftListView : UIView
/// 语圈id
@property (nonatomic,strong)NSString* dynamicId;
@property (nonatomic,strong)UIViewController *vc;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
@interface QXGiveGiftListCell : UITableViewCell
@property (nonatomic,strong)UIImageView *rankingImageView;
@property (nonatomic,strong)UILabel *rankingLabel;
@property (nonatomic,strong)UIImageView *headerImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *giftLabel;
@property (nonatomic,strong)UIButton *followBtn;
@property (nonatomic,strong)QXUserHomeModel *model;
@property (nonatomic,copy)void(^clickUserBlock)(QXUserHomeModel *model);
+(instancetype)cellWithTableView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,236 @@
//
// QXGiveGiftListView.m
// QXLive
//
// Created by on 2025/5/29.
//
#import "QXGiveGiftListView.h"
#import "QXDynamicNetwork.h"
@interface QXGiveGiftListView()<UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@end
@implementation QXGiveGiftListView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.backgroundColor = [UIColor clearColor];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, self.width, ScaleWidth(429)+kSafeAreaBottom)];
self.bgView.backgroundColor = [UIColor whiteColor];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 25, self.width-32, 27)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.titleLabel.textColor = RGB16(0x333333);
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.text = QXText(@"打赏榜单");
[self.bgView addSubview:self.titleLabel];
[self.bgView addSubview:self.tableView];
}
-(void)setDynamicId:(NSString *)dynamicId{
_dynamicId = dynamicId;
[self getList];
}
-(void)getList{
MJWeakSelf
[QXDynamicNetwork dynamicGiveGiftListWithId:self.dynamicId successBlock:^(NSArray<QXUserHomeModel *> * _Nonnull list) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:list];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXGiveGiftListCell *cell = [QXGiveGiftListCell cellWithTableView:tableView];
if (indexPath.row == 0) {
cell.rankingImageView.hidden = NO;
cell.rankingLabel.hidden = YES;
cell.rankingImageView.image = [UIImage imageNamed:@"ranking_first"];
}else if (indexPath.row == 1){
cell.rankingImageView.hidden = NO;
cell.rankingLabel.hidden = YES;
cell.rankingImageView.image = [UIImage imageNamed:@"ranking_second"];
}else if (indexPath.row == 2){
cell.rankingImageView.hidden = NO;
cell.rankingLabel.hidden = YES;
cell.rankingImageView.image = [UIImage imageNamed:@"ranking_third"];
}else{
cell.rankingImageView.hidden = YES;
cell.rankingLabel.hidden = NO;
cell.rankingLabel.text = [NSString stringWithFormat:@"%ld",indexPath.row];
}
QXUserHomeModel *model = self.dataArray[indexPath.row];
cell.model = model;
MJWeakSelf
cell.clickUserBlock = ^(QXUserHomeModel * _Nonnull model) {
[weakSelf hide];
[weakSelf performSelector:@selector(chatAction:) withObject:model afterDelay:0.3];
};
return cell;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
-(void)chatAction:(QXUserHomeModel*)model{
[[QXGlobal shareGlobal] chatWithUserID:model.user_id nickname:model.nickname avatar:model.avatar navagationController:self.vc.navigationController];
}
-(UITableView *)tableView{
if (!_tableView) {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+6, self.width, self.height-self.titleLabel.bottom-6) style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.rowHeight = 54;
[self.tableView addRoundedCornersWithRadius:6];
}
return _tableView;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
@end
@implementation QXGiveGiftListCell
+(instancetype)cellWithTableView:(UITableView*)tableView{
static NSString *cellId = @"QXGiveGiftListCell";
QXGiveGiftListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXGiveGiftListCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.rankingImageView = [[UIImageView alloc] init];
[self.contentView addSubview:self.rankingImageView];
[self.rankingImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.size.mas_equalTo(CGSizeMake(16, 16));
make.centerY.equalTo(self);
}];
self.rankingLabel = [[UILabel alloc] init];
self.rankingLabel.font = [UIFont systemFontOfSize:14];
self.rankingLabel.textColor = RGB16(0x666666);
self.rankingLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.rankingLabel];
[self.rankingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.height.mas_equalTo(16);
make.centerY.equalTo(self);
make.width.mas_equalTo(25);
}];
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.headerImageView];
[self.headerImageView addRoundedCornersWithRadius:20];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.rankingImageView.mas_right).offset(12);
make.size.mas_equalTo(CGSizeMake(40, 40));
make.centerY.equalTo(self);
}];
self.followBtn = [[UIButton alloc] init];
[self.followBtn setImage:[UIImage imageNamed:@"expansion_call"] forState:(UIControlStateNormal)];
[self.followBtn addTarget:self action:@selector(followAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.contentView addSubview:self.followBtn];
[self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self);
make.height.mas_equalTo(24);
make.width.mas_equalTo(70);
make.right.mas_equalTo(-16);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.font = [UIFont systemFontOfSize:14];
self.nameLabel.textColor = QXConfig.textColor;
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerImageView.mas_right).offset(8);
make.top.equalTo(self.headerImageView.mas_top).offset(-2);
make.height.mas_equalTo(21);
make.right.equalTo(self.followBtn.mas_left).offset(-16);
}];
self.giftLabel = [[UILabel alloc] init];
self.giftLabel.font = [UIFont systemFontOfSize:14];
self.giftLabel.textColor = RGB16(0xF4DF39);
[self.contentView addSubview:self.giftLabel];
[self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerImageView.mas_right).offset(8);
make.top.equalTo(self.nameLabel.mas_bottom);
make.height.mas_equalTo(21);
make.right.equalTo(self.followBtn.mas_left).offset(-16);
}];
}
-(void)setModel:(QXUserHomeModel *)model{
_model = model;
self.nameLabel.text = model.nickname;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.giftLabel.text = model.total_price;
}
-(void)followAction{
if (self.clickUserBlock) {
self.clickUserBlock(self.model);
}
}
@end

View File

@@ -0,0 +1,34 @@
//
// QXMenuPopView.h
// QXLive
//
// Created by 启星 on 2025/5/28.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger) {
QXMenuPopViewTypeArrowTop = 0,
QXMenuPopViewTypeArrowBottom
}QXMenuPopViewType;
NS_ASSUME_NONNULL_BEGIN
@protocol QXMenuPopViewDelegate <NSObject>
@optional
-(void)didSelectedIndex:(NSInteger)index menuTitle:(NSString*)menuTitle;
@end
@interface QXMenuPopView : UIView
@property (nonatomic,strong)NSArray *dataArray;
@property (nonatomic,weak)id<QXMenuPopViewDelegate>delegate;
@property (nonatomic,assign)QXMenuPopViewType type;
-(instancetype)initWithPoint:(CGPoint)point;
-(instancetype)initWithPoint:(CGPoint)point width:(CGFloat)width height:(CGFloat)height;
-(void)showInView:(UIView *)view;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,165 @@
//
// QXMenuPopView.m
// QXLive
//
// Created by on 2025/5/28.
//
#import "QXMenuPopView.h"
@interface QXMenuPopView()<UITableViewDataSource,UITableViewDelegate,UIGestureRecognizerDelegate>
@property (nonatomic,strong)UIView *arrowView;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,assign)CGPoint point;
@property (nonatomic,assign)CGFloat width;
@property (nonatomic,assign)CGFloat height;
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation QXMenuPopView
-(instancetype)initWithPoint:(CGPoint)point{
if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
self.frame = [UIScreen mainScreen].bounds;
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
_point = point;
_width = 88;
_height = 103;
[self initSubviews];
}
return self;
}
-(instancetype)initWithPoint:(CGPoint)point width:(CGFloat)width height:(CGFloat)height{
if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
self.frame = [UIScreen mainScreen].bounds;
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
_point = point;
_width = width;
_height = height;
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(_point.x -_width/2, _point.y, _width, _height)];
self.bgView.clipsToBounds = YES;
[self addSubview:self.bgView];
[self.bgView addSubview:self.tableView];
}
-(void)setDataArray:(NSArray *)dataArray{
_dataArray = dataArray;
[self.tableView reloadData];
}
-(void)setType:(QXMenuPopViewType)type{
_type = type;
switch (type) {
case QXMenuPopViewTypeArrowTop:
self.bgView.frame = CGRectMake(_point.x -_width/2, _point.y, _width, _height);
self.arrowView.frame = CGRectMake((_width-12)/2, 3, 12, 12);
self.tableView.frame = CGRectMake(0, self.arrowView.top+5, self.bgView.width, self.bgView.height-13);
self.arrowView = [[UIView alloc] initWithFrame:CGRectMake((_width-12)/2, 3, 12, 12)];
self.arrowView.backgroundColor = [UIColor whiteColor];
self.arrowView.transform = CGAffineTransformMakeRotation(45 * M_PI/180.0);
[self.bgView insertSubview:self.arrowView belowSubview:self.tableView];
break;
case QXMenuPopViewTypeArrowBottom:
self.bgView.frame = CGRectMake(_point.x -_width/2, _point.y, _width, _height);
self.tableView.frame = CGRectMake(0, 0, self.bgView.width, self.bgView.height-16);
self.arrowView = [[UIView alloc] initWithFrame:CGRectMake((_width-12)/2, self.tableView.bottom-8, 12, 12)];
self.arrowView.backgroundColor = [UIColor whiteColor];
self.arrowView.transform = CGAffineTransformMakeRotation(45 * M_PI/180.0);
[self.bgView insertSubview:self.arrowView belowSubview:self.tableView];
break;
default:
break;
}
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QXMenuCell"];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:@"QXMenuCell"];
}
cell.textLabel.text = self.dataArray[indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:12];
cell.textLabel.textColor = RGB16(0x999999);
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self hide];
if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectedIndex:menuTitle:)]) {
[self.delegate didSelectedIndex:indexPath.row menuTitle:self.dataArray[indexPath.row]];
}
}
-(UITableView *)tableView{
if (!_tableView) {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.arrowView.top+5, self.bgView.width, self.bgView.height-13) style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.rowHeight = 30;
self.tableView.bounces = NO;
[self.tableView addRoundedCornersWithRadius:6];
}
return _tableView;
}
-(void)showInView:(UIView *)view{
if (self.type == QXMenuPopViewTypeArrowTop) {
self.bgView.height = 0;
[view addSubview:self];
[UIView animateWithDuration:0.1 animations:^{
self.bgView.height = self.height;
}];
}else{
self.bgView.height = 0;
self.bgView.y = self.point.y+self.height;
[view addSubview:self];
[UIView animateWithDuration:0.1 animations:^{
self.bgView.height = self.height;
self.bgView.y = self.point.y;
}];
}
}
-(void)hide{
if (self.type == QXMenuPopViewTypeArrowTop) {
[UIView animateWithDuration:0.1 animations:^{
self.bgView.height = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}else{
[UIView animateWithDuration:0.1 animations:^{
self.bgView.height = 0;
self.bgView.y = self.point.y+self.height;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXSelectedTopicView.h
// QXLive
//
// Created by 启星 on 2025/5/27.
//
#import <UIKit/UIKit.h>
#import "QXDynamicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXSelectedTopicView : UIView
@property (nonatomic,strong)NSArray <QXTopicModel*> *selectedTopic;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,67 @@
//
// QXSelectedTopicView.m
// QXLive
//
// Created by on 2025/5/27.
//
#import "QXSelectedTopicView.h"
@interface QXSelectedTopicView()
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIImageView *arrowImageView;
@end
@implementation QXSelectedTopicView
- (instancetype)init
{
self = [super init];
if (self) {
[self initSubviews];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.text = QXText(@"选择话题");
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.textColor = QXConfig.textColor;
[self addSubview:self.titleLabel];
self.arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrowRight"]];
[self addSubview:self.arrowImageView];
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-12);
make.size.mas_equalTo(CGSizeMake(16, 16));
make.centerY.equalTo(self);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.right.equalTo(self.arrowImageView.mas_left).offset(-12);
make.centerY.equalTo(self);
}];
}
-(void)setSelectedTopic:(NSArray< QXTopicModel *>*)selectedTopic{
_selectedTopic = selectedTopic;
NSString *topic = @"";
for (QXTopicModel*md in selectedTopic) {
if (topic.length == 0) {
topic = [topic stringByAppendingFormat:@"%@",md.title];
}else{
topic = [topic stringByAppendingFormat:@",%@",md.title];
}
}
self.titleLabel.text = topic;
}
@end

View File

@@ -0,0 +1,118 @@
//
// QXSendGiftView.h
// QXLive
//
// Created by 启星 on 2025/5/29.
//
#import <UIKit/UIKit.h>
#import "JXCategoryView.h"
#import "QXRoomModel.h"
#import "QXGiftModel.h"
#import "QXUserModel.h"
typedef NS_ENUM(NSInteger) {
/// 发现打赏
QXSendGiftViewTypeFind = 0,
/// 房间送礼
QXSendGiftViewTypeRoom ,
/// 拍卖
QXSendGiftViewTypeAuction ,
}QXSendGiftViewType;
NS_ASSUME_NONNULL_BEGIN
@interface QXSendGiftView : UIView
-(instancetype)initWithType:(QXSendGiftViewType)type;
@property (nonatomic,assign)QXSendGiftViewType type;
@property (nonatomic,strong)NSMutableArray *titles;
@property (nonatomic,strong)UINavigationController *navgationVC;
@property (nonatomic,strong)UIViewController *vc;
@property (nonatomic,strong)NSArray *pitUsers;
/// 用户模型
@property (nonatomic,strong)QXRoomPitModel *userModel;
/// 房间id 房间送礼物时传
@property (nonatomic,strong)NSString* roomId;
/// 语圈id
@property (nonatomic,strong)NSString* dynamicId;
/// 拍卖id
@property (nonatomic,strong)NSString* auctionId;
@property (nonatomic,copy)void(^sendSuccessBlock)(NSString*dynamicId);
@property (nonatomic,copy)void(^roomSendSuccessBlock)(BOOL isAuction, QXGiftModel*giftModel,NSString*userId, NSString*auctionId);
-(void)reloadData;
-(void)showInView:(UIView *)view;
-(void)hide;
@end
@interface QXSendGiftCollectionView : UIView<UICollectionViewDelegate,UICollectionViewDataSource,JXCategoryListContentViewDelegate>
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSString *giftLabelId;
@property (nonatomic,assign)NSInteger selectedIndex;
@property (nonatomic,copy)void(^selectetGiftBlock)(QXGiftModel *gift);
@end
@interface QXSendGiftUserView : UIView<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UILabel *titltLabel;
@property (nonatomic,strong)UIButton *detailBtn;
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,strong)UIView *lineView;
@property (nonatomic,strong)NSMutableArray *dataArray;
/// 语圈id
@property (nonatomic,strong)NSString* dynamicId;
@property (nonatomic,strong)UIViewController *vc;
@end
@interface QXSendGiftUserCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *imageView;
@property (nonatomic,strong)QXRoomPitModel *pitModel;
@property (nonatomic,strong)QXUserHomeModel *sendUserModel;
@end
@interface QXSendGiftPitUserView : UIView<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic,strong)UICollectionView *collectionView;
/// 全麦
@property (nonatomic,strong)UIButton *allBtn;
/// 是否为麦位
@property (nonatomic,assign)BOOL isPitUser;
/// 是否是给单人送礼物
@property (nonatomic,assign)BOOL isSingle;
@property (nonatomic,strong)NSArray* users;
@property (nonatomic,strong)NSMutableArray* selectedArray;
@end
@interface QXSendGiftPitUserCell : UICollectionViewCell
@property (nonatomic,strong)UIButton *selectedBtn;
@property (nonatomic,strong)UIImageView *headerImageView;
@property (nonatomic,strong)QXRoomPitModel *pitModel;
@end
@interface QXContinuousGiftView : UIView<CAAnimationDelegate>
@property (nonatomic,strong)CAShapeLayer *circleLayer;
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UIButton *sendBtn;
@property (nonatomic,strong)QXGiftModel *giftModel;
@property (nonatomic,assign)BOOL isAuction;
@property (nonatomic,strong)NSString *userId;
@property (nonatomic,strong)NSString *auctionId;
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)CABasicAnimation *animation;
@property (nonatomic,copy)void(^dissMissBlock)(QXGiftModel *gift);
@end
NS_ASSUME_NONNULL_END

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
//
// QXTopicListView.h
// QXLive
//
// Created by 启星 on 2025/5/28.
//
#import <UIKit/UIKit.h>
#import "QXDynamicNetwork.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXTopicListView : UIView
@property (nonatomic,copy)void(^selecctedTopicBlock)(NSArray<QXTopicModel*>*topicArr);
@end
@interface QXTopicListViewCell : UITableViewCell
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *rightBtn;
@property (nonatomic,strong)QXTopicModel *model;
+(instancetype)cellWithTableView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,201 @@
//
// QXTopicListView.m
// QXLive
//
// Created by on 2025/5/28.
//
#import "QXTopicListView.h"
@interface QXTopicListView()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSMutableArray *selectedArray;
@property (nonatomic,strong)UILabel* titleLabel;
@property (nonatomic,assign)NSInteger page;
@property (nonatomic,strong)UIButton* cancelBtn;
@property (nonatomic,strong)UIButton* commitBtn;
@end
@implementation QXTopicListView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.page = 1;
self.backgroundColor = [UIColor whiteColor];
[self addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-100)/2, 16, 100, 27)];
self.titleLabel.text = QXText(@"选择话题");
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
[self addSubview:self.titleLabel];
self.cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 12, 65, 35)];
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
[self.cancelBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.cancelBtn];
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-65, 12, 65, 35)];
[self.commitBtn setTitle:QXText(@"确定") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
// self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn addRoundedCornersWithRadius:17.5];
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.commitBtn];
[self addSubview:self.tableView];
[self getTopic];
}
-(void)getTopic{
MJWeakSelf
[weakSelf.selectedArray removeAllObjects];
[QXDynamicNetwork getTopicListWithPage:self.page isTopTopic:NO
successBlock:^(NSArray<QXTopicModel *> * _Nonnull hotos) {
if (weakSelf.page == 1) {
[weakSelf.dataArray removeAllObjects];
}
[weakSelf.dataArray addObjectsFromArray:hotos];
[weakSelf.tableView.mj_header endRefreshing];
if (hotos.count == 0) {
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
}else{
[weakSelf.tableView.mj_footer endRefreshing];
}
[self.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
[weakSelf.tableView.mj_header endRefreshing];
[weakSelf.tableView.mj_footer endRefreshing];
}];
}
-(void)cancelAction{
[[QXGlobal shareGlobal] hideViewBlock:^{}];
}
-(void)commitAction{
MJWeakSelf
[[QXGlobal shareGlobal] hideViewBlock:^{
if (weakSelf.selecctedTopicBlock) {
weakSelf.selecctedTopicBlock(weakSelf.selectedArray);
}
}];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXTopicListViewCell *cell = [QXTopicListViewCell cellWithTableView:tableView];
QXTopicModel *model = self.dataArray[indexPath.row];
cell.model = model;
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
QXTopicModel *model = self.dataArray[indexPath.row];
model.isSelected = !model.isSelected;
[tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:(UITableViewRowAnimationAutomatic)];
if (model.isSelected) {
[self.selectedArray addObject:model];
}else{
[self.selectedArray removeObject:model];
}
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+8, self.width, self.height-16-self.titleLabel.bottom-8) style:UITableViewStylePlain];
_tableView.backgroundColor = [UIColor clearColor];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.rowHeight = 48;
MJWeakSelf
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
weakSelf.page = 1;
[weakSelf getTopic];
}];
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf getTopic];
}];
}
return _tableView;
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(NSMutableArray *)selectedArray{
if (!_selectedArray) {
_selectedArray = [NSMutableArray array];
}
return _selectedArray;
}
@end
@implementation QXTopicListViewCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString* cellId = @"QXTopicListViewCell";
QXTopicListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXTopicListViewCell 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)initSubviews{
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.titleLabel];
self.rightBtn = [[UIButton alloc] init];
[self.rightBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)];
[self.rightBtn setImage:[UIImage imageNamed:@"login_agreement_nor"] forState:(UIControlStateNormal)];
[self.contentView addSubview:self.rightBtn];
[self.rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.height.width.mas_equalTo(20);
make.centerY.equalTo(self.contentView);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.height.mas_equalTo(24);
make.centerY.equalTo(self.contentView);
make.right.equalTo(self.rightBtn.mas_left).offset(-10);
}];
}
-(void)setModel:(QXTopicModel *)model{
_model = model;
self.titleLabel.text = model.title;
self.rightBtn.selected = model.isSelected;
}
@end

View File

@@ -0,0 +1,17 @@
//
// QXToppicDynamicTopView.h
// QXLive
//
// Created by 启星 on 2025/6/3.
//
#import <UIKit/UIKit.h>
#import "QXDynamicModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXToppicDynamicTopView : UIView
-(instancetype)initWithModel:(QXTopicModel*)model;
@property (nonatomic,strong)QXTopicModel *model;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,77 @@
//
// QXToppicDynamicTopView.m
// QXLive
//
// Created by on 2025/6/3.
//
#import "QXToppicDynamicTopView.h"
@interface QXToppicDynamicTopView()
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIImageView *topicImageView;
@property (nonatomic,strong)UIImageView *tagImageView;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UILabel *contentLabel;
@end
@implementation QXToppicDynamicTopView
-(void)setModel:(QXTopicModel *)model{
_model = model;
self.titleLabel.text = model.title;
[self.topicImageView sd_setImageWithURL:[NSURL URLWithString:model.pic]];
self.countLabel.text = [NSString localizedStringWithFormat:QXText(@"%@条动态"),[NSString qx_showHotCountNum:model.count.longLongValue]];
self.contentLabel.text = model.content;
}
//- (instancetype)initWithFrame:(CGRect)frame
//{
// self = [super initWithFrame:frame];
// if (self) {
// [self initSubviews];
// }
// return self;
//}
-(instancetype)initWithModel:(QXTopicModel *)model{
self = [super init];
if (self) {
_model = model;
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.topicImageView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 12, 45, 45)];
self.topicImageView.contentMode = UIViewContentModeScaleAspectFill;
self.topicImageView.clipsToBounds = YES;
[self.topicImageView addRoundedCornersWithRadius:4];
[self addSubview:self.topicImageView];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.topicImageView.right+7, self.topicImageView.top, SCREEN_WIDTH-self.topicImageView.right-7-16, 24)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16.f];
self.titleLabel.textColor = QXConfig.textColor;
[self addSubview:self.titleLabel];
self.tagImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dynamic_topic_tag"]];
self.tagImageView.frame = CGRectMake(self.titleLabel.left, self.titleLabel.bottom+7, 37 , 13);
[self addSubview:self.tagImageView];
self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.tagImageView.right+4, self.titleLabel.bottom+4, SCREEN_WIDTH-self.tagImageView.right-4-16, 18)];
self.countLabel.font = [UIFont systemFontOfSize:12.f];
self.countLabel.textColor = RGB16(0x999999);
[self addSubview:self.countLabel];
self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, self.topicImageView.bottom+12, SCREEN_WIDTH-32, 20)];
self.contentLabel.textColor = RGB16(0x666666);
self.contentLabel.font = [UIFont systemFontOfSize:12.f];;
self.contentLabel.numberOfLines = 0;
[self addSubview:self.contentLabel];
[self setModel:self.model];
[self.contentLabel sizeToFit];
self.contentLabel.frame = CGRectMake(16, self.topicImageView.bottom+12, SCREEN_WIDTH-32, self.contentLabel.height);
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, self.contentLabel.bottom+3);
}
@end

View File

@@ -0,0 +1,23 @@
//
// QXDynamicCommentCell.h
// QXLive
//
// Created by 启星 on 2025/6/4.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXDynamicCommentCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIView *topCornerView;
@property (weak, nonatomic) IBOutlet UIView *bottomCornerView;
@property (nonatomic,strong)QXDynamicCommentListModel *model;
@property (nonatomic,copy)void(^longPressBlock)(QXDynamicCommentListModel *model);
@property (weak, nonatomic) IBOutlet UILabel *commentLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,61 @@
//
// QXDynamicCommentCell.m
// QXLive
//
// Created by on 2025/6/4.
//
#import "QXDynamicCommentCell.h"
@implementation QXDynamicCommentCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXDynamicCommentCell";
QXDynamicCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
cell.backgroundColor = [UIColor clearColor];
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:cell action:@selector(handleLongPress:)];
[cell addGestureRecognizer:longPress];
}
return cell;
}
-(void)setModel:(QXDynamicCommentListModel *)model{
_model = model;
NSString *commentUser = @"";
if (model.reply_to_user.length == 0) {
commentUser = [NSString stringWithFormat:@"%@",model.nickname];
}else{
commentUser = [NSString localizedStringWithFormat:QXText(@"%@ 回复 %@"),model.nickname,model.reply_to_user];
}
NSString* content = [NSString stringWithFormat:@"%@%@",commentUser,model.content];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:content];
[attr yy_setColor:RGB16(0x999999) range:[content rangeOfString:model.content]];
[attr yy_setColor:RGB16(0x333333) range:[content rangeOfString:commentUser]];
self.commentLabel.attributedText = attr;
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)handleLongPress:(UILongPressGestureRecognizer *)gesture{
if (gesture.state == UIGestureRecognizerStateBegan) {
if (self.longPressBlock) {
self.longPressBlock(self.model);
}
}
}
- (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,127 @@
<?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="141" id="KGk-i7-Jjw" customClass="QXDynamicCommentCell">
<rect key="frame" x="0.0" y="0.0" width="428" height="141"/>
<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="428" height="141"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xpB-b7-lGw">
<rect key="frame" x="64" y="0.0" width="348" height="141"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wj3-tk-zlh">
<rect key="frame" x="0.0" y="0.0" width="348" height="24"/>
<color key="backgroundColor" red="0.97647058819999999" green="0.97647058819999999" blue="0.97647058819999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="VRd-E6-wjg"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ujm-d6-5zi">
<rect key="frame" x="0.0" y="12" width="348" height="117"/>
<color key="backgroundColor" red="0.97647058819999999" green="0.97647058819999999" blue="0.97647058819999999" alpha="1" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tn3-vd-O5b">
<rect key="frame" x="0.0" y="117" width="348" height="24"/>
<color key="backgroundColor" red="0.97647058819999999" green="0.97647058819999999" blue="0.97647058819999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="WbI-tI-87v"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MH7-oM-77U">
<rect key="frame" x="12" y="12" width="324" height="98"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ovO-RW-ILy">
<rect key="frame" x="12" y="116" width="31" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="PFb-yy-Wz2"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.57647058823529407" green="0.57647058823529407" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BDR-Dd-yF8">
<rect key="frame" x="53" y="116" width="38" height="20"/>
<color key="backgroundColor" red="0.96078431372549022" green="0.96078431372549022" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="38" id="DYo-ky-Mwr"/>
<constraint firstAttribute="height" constant="20" id="P7V-zS-ieb"/>
</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" red="0.57647058823529407" green="0.57647058823529407" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</button>
</subviews>
<constraints>
<constraint firstItem="MH7-oM-77U" firstAttribute="top" secondItem="xpB-b7-lGw" secondAttribute="top" constant="12" id="7HG-rN-ZXB"/>
<constraint firstItem="ovO-RW-ILy" firstAttribute="top" secondItem="MH7-oM-77U" secondAttribute="bottom" constant="6" id="CDA-7f-DI4"/>
<constraint firstItem="wj3-tk-zlh" firstAttribute="top" secondItem="xpB-b7-lGw" secondAttribute="top" id="CtL-8c-2EE"/>
<constraint firstItem="Tn3-vd-O5b" firstAttribute="top" secondItem="Ujm-d6-5zi" secondAttribute="bottom" constant="-12" id="DXX-9k-jtw"/>
<constraint firstAttribute="trailing" secondItem="Ujm-d6-5zi" secondAttribute="trailing" id="FoU-Ue-edq"/>
<constraint firstAttribute="bottom" secondItem="Tn3-vd-O5b" secondAttribute="bottom" id="GrF-LO-MKV"/>
<constraint firstItem="wj3-tk-zlh" firstAttribute="leading" secondItem="xpB-b7-lGw" secondAttribute="leading" id="KIq-S2-f5X"/>
<constraint firstAttribute="trailing" secondItem="MH7-oM-77U" secondAttribute="trailing" constant="12" id="LbR-uJ-Rnz"/>
<constraint firstItem="BDR-Dd-yF8" firstAttribute="centerY" secondItem="ovO-RW-ILy" secondAttribute="centerY" id="Pl5-d4-uSY"/>
<constraint firstAttribute="trailing" secondItem="wj3-tk-zlh" secondAttribute="trailing" id="WM9-UL-gVo"/>
<constraint firstAttribute="trailing" secondItem="Tn3-vd-O5b" secondAttribute="trailing" id="XBe-4U-aAO"/>
<constraint firstItem="Tn3-vd-O5b" firstAttribute="leading" secondItem="xpB-b7-lGw" secondAttribute="leading" id="Z1D-TT-RqS"/>
<constraint firstItem="Ujm-d6-5zi" firstAttribute="top" secondItem="wj3-tk-zlh" secondAttribute="bottom" constant="-12" id="foT-ME-nSA"/>
<constraint firstItem="BDR-Dd-yF8" firstAttribute="leading" secondItem="ovO-RW-ILy" secondAttribute="trailing" constant="10" id="nVH-R6-2RG"/>
<constraint firstItem="Ujm-d6-5zi" firstAttribute="leading" secondItem="xpB-b7-lGw" secondAttribute="leading" id="nqu-b6-z28"/>
<constraint firstAttribute="bottom" secondItem="ovO-RW-ILy" secondAttribute="bottom" constant="5" id="tAa-xh-nWW"/>
<constraint firstItem="MH7-oM-77U" firstAttribute="leading" secondItem="xpB-b7-lGw" secondAttribute="leading" constant="12" id="vi3-5m-DoP"/>
<constraint firstItem="ovO-RW-ILy" firstAttribute="leading" secondItem="xpB-b7-lGw" secondAttribute="leading" constant="12" id="z0e-oe-D3t"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="xpB-b7-lGw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="64" id="3Yn-bs-fOw"/>
<constraint firstItem="xpB-b7-lGw" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="D52-la-m9V"/>
<constraint firstAttribute="bottom" secondItem="xpB-b7-lGw" secondAttribute="bottom" id="Ohy-Rl-W1F"/>
<constraint firstAttribute="trailing" secondItem="xpB-b7-lGw" secondAttribute="trailing" constant="16" id="cP3-J2-kVq"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="bottomCornerView" destination="Tn3-vd-O5b" id="Wgj-q4-Hzn"/>
<outlet property="commentLabel" destination="MH7-oM-77U" id="d4v-SC-qU7"/>
<outlet property="timeLabel" destination="ovO-RW-ILy" id="lPo-Fk-HLc"/>
<outlet property="topCornerView" destination="wj3-tk-zlh" id="xnW-5L-NJs"/>
</connections>
<point key="canvasLocation" x="221.37404580152671" y="32.74647887323944"/>
</tableViewCell>
</objects>
</document>

View File

@@ -0,0 +1,25 @@
//
// QXDynamicCommentHeaderView.h
// QXLive
//
// Created by 启星 on 2025/6/4.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol QXDynamicCommentHeaderViewDelegate <NSObject>
@optional
-(void)didClickDeleteComment:(QXDynamicCommentListModel*)model;
-(void)didClickReplyComment:(QXDynamicCommentListModel*)model;
@end
@interface QXDynamicCommentHeaderView : UIView
@property (nonatomic,strong)QXDynamicCommentListModel *model;
@property (nonatomic,weak)id<QXDynamicCommentHeaderViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,128 @@
//
// QXDynamicCommentHeaderView.m
// QXLive
//
// Created by on 2025/6/4.
//
#import "QXDynamicCommentHeaderView.h"
@interface QXDynamicCommentHeaderView()
@property (nonatomic,strong)UIImageView *headerImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *contentLabel;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UIButton *replyBtn;
@property (nonatomic,strong)UIButton *deleteBtn;
@end
@implementation QXDynamicCommentHeaderView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.headerImageView = [[UIImageView alloc] init];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.headerImageView addRoundedCornersWithRadius:20];
[self addSubview:self.headerImageView];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.height.width.mas_equalTo(40);
make.top.mas_equalTo(12);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = [UIColor blackColor];
self.nameLabel.font = [UIFont systemFontOfSize:12];
[self addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.headerImageView.mas_right).offset(7);
make.height.mas_equalTo(16);
make.top.mas_equalTo(12);
make.right.mas_equalTo(-16);
}];
self.contentLabel = [[UILabel alloc] init];
self.contentLabel.textColor = [UIColor blackColor];
self.contentLabel.font = [UIFont systemFontOfSize:14];
self.contentLabel.numberOfLines = 0;
[self addSubview:self.contentLabel];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel);
make.top.equalTo(self.nameLabel.mas_bottom).offset(7);
make.right.mas_equalTo(-16);
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textColor = RGB16(0x939393);
self.timeLabel.font = [UIFont systemFontOfSize:12];
[self addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel);
make.height.mas_equalTo(20);
make.top.equalTo(self.contentLabel.mas_bottom).offset(2);
}];
self.replyBtn = [[UIButton alloc] init];
[self.replyBtn setTitle:QXText(@"回复") forState:(UIControlStateNormal)];
self.replyBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.replyBtn setTitleColor:RGB16(0x939393) forState:(UIControlStateNormal)];
[self.replyBtn addRoundedCornersWithRadius:5];
self.replyBtn.backgroundColor = RGB16(0xF5F5F5);
[self.replyBtn addTarget:self action:@selector(replyAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.replyBtn];
[self.replyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.timeLabel.mas_right).offset(12);
make.height.mas_equalTo(20);
make.width.mas_equalTo(ScaleWidth(38));
make.centerY.equalTo(self.timeLabel);
}];
self.deleteBtn = [[UIButton alloc] init];
[self.deleteBtn setTitle:QXText(@"删除") forState:(UIControlStateNormal)];
self.deleteBtn.titleLabel.font = [UIFont systemFontOfSize:12];
[self.deleteBtn setTitleColor:RGB16(0x939393) forState:(UIControlStateNormal)];
[self.deleteBtn addTarget:self action:@selector(deleteAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.deleteBtn];
[self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.replyBtn.mas_right).offset(6);
make.height.mas_equalTo(20);
make.width.mas_equalTo(ScaleWidth(38));
make.centerY.equalTo(self.timeLabel);
}];
}
-(void)setModel:(QXDynamicCommentListModel *)model{
_model = model;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.nameLabel.text = model.nickname;
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;
if ([model.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
self.deleteBtn.hidden = NO;
}else{
self.deleteBtn.hidden = YES;
}
}
-(void)replyAction{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickReplyComment:)]) {
[self.delegate didClickReplyComment:self.model];
}
}
-(void)deleteAction{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickDeleteComment:)]) {
[self.delegate didClickDeleteComment:self.model];
}
}
@end

View File

@@ -0,0 +1,27 @@
//
// QXDynamicCommentInputView.h
// QXLive
//
// Created by 启星 on 2025/6/4.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol QXDynamicCommentInputViewDelegate <NSObject>
@optional
-(void)didClickSendWithText:(NSString*)text model:(QXDynamicCommentListModel*)model;
@end
@interface QXDynamicCommentInputView : UIView
@property (nonatomic,strong)UITextField *textField;
@property (nonatomic,strong)QXDynamicCommentListModel *model;
@property (nonatomic,weak)id<QXDynamicCommentInputViewDelegate>delegate;
-(void)inputBecomeFirstResponder;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,113 @@
//
// QXDynamicCommentInputView.m
// QXLive
//
// Created by on 2025/6/4.
//
#import "QXDynamicCommentInputView.h"
@interface QXDynamicCommentInputView()<UITextFieldDelegate>
@property (nonatomic,strong)UICollectionView *collectionViwew;
@property (nonatomic,strong)UIView *inputBgView;
@property (nonatomic,strong)UIView *inputShadowView;
@property (nonatomic,strong)UIButton *sendBtn;
@end
@implementation QXDynamicCommentInputView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor whiteColor];
self.sendBtn = [[UIButton alloc] init];
self.sendBtn.needEventInterval = 0.5;
[self.sendBtn setTitle:QXText(@"发送") forState:(UIControlStateNormal)];
self.sendBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.sendBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.sendBtn.backgroundColor = QXConfig.themeColor;
[self.sendBtn addRoundedCornersWithRadius:17.5];
[self.sendBtn addTarget:self action:@selector(sendAction) forControlEvents:(UIControlEventTouchUpInside)];;
[self addSubview:self.sendBtn];
[self.sendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.top.mas_equalTo(8);
make.height.mas_equalTo(35);
make.width.mas_equalTo(80);
}];
self.inputBgView = [[UIView alloc] init];
self.inputBgView.backgroundColor = RGB16(0xF5F5F5);
[self.inputBgView addRoundedCornersWithRadius:8];
[self addSubview:self.inputBgView];
[self.inputBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.equalTo(self.sendBtn.mas_left).offset(-12);
make.centerY.equalTo(self.sendBtn);
make.height.mas_equalTo(35);
}];
self.textField = [[UITextField alloc] init];
self.textField.font = [UIFont systemFontOfSize:14];
self.textField.textColor = QXConfig.textColor;
self.textField.returnKeyType = UIReturnKeyDone;
self.textField.delegate = self;
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:UIControlEventEditingChanged];
[self.inputBgView addSubview:self.textField];
[self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.right.mas_equalTo(-10);
make.top.bottom.equalTo(self.inputBgView);
}];
self.inputShadowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 4)];
self.inputShadowView.backgroundColor = [UIColor whiteColor];
self.inputShadowView.layer.shadowColor = [UIColor grayColor].CGColor;
self.inputShadowView.layer.shadowOpacity = 0.2;
self.inputShadowView.layer.shadowOffset = CGSizeMake(0, -2);
self.inputShadowView.layer.shadowRadius = 2;
self.inputShadowView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.inputShadowView.bounds cornerRadius:self.inputShadowView.layer.cornerRadius].CGPath;
self.inputShadowView.layer.cornerRadius = 2;
self.inputShadowView.layer.masksToBounds = NO;
[self addSubview:self.inputShadowView];
// self.inputShadowView.layer.shadowColor = [UIColor grayColor].CGColor;
// self.inputShadowView.layer.shadowOpacity = 0.5;
// self.inputShadowView.layer.shadowOffset = CGSizeMake(0, -2);
//// self.inputShadowView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:0].CGPath;
// self.inputShadowView.layer.masksToBounds = NO;
}
-(void)textDidChange:(UITextField*)textField{
if (textField.text.length>50) {
showToast(@"评论不得超过50个字符");
textField.text = [textField.text substringToIndex:50];
}
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
-(void)setModel:(QXDynamicCommentListModel *)model{
_model = model;
}
-(void)inputBecomeFirstResponder{
[self.textField becomeFirstResponder];
}
-(void)sendAction{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickSendWithText:model:)]) {
[self.delegate didClickSendWithText:self.textField.text model:self.model];
}
}
@end