修改了动态的话题的UI

This commit is contained in:
fengshuo
2023-01-04 17:21:42 +08:00
parent 79384b65e8
commit 5199bb3362
3 changed files with 22 additions and 21 deletions

View File

@@ -11,13 +11,14 @@
///Tool
#import "ThemeColor.h"
#import "UIImage+Utils.h"
#import "NetImageView.h"
///Model
#import "MonentsTopicModel.h"
@interface XPMonentsTopicCollectionViewCell ()
///
@property (nonatomic,strong) UIImageView *topicImageView;
@property (nonatomic,strong) NetImageView *topicImageView;
///#
@property (nonatomic,strong) UIImageView *iconImageView;
///
@@ -48,14 +49,13 @@
}];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.topicImageView).offset(7);
make.size.mas_equalTo(CGSizeMake(25, 25));
make.centerY.mas_equalTo(self.topicImageView);
make.left.right.bottom.mas_equalTo(self.topicImageView);
make.height.mas_equalTo(30);
}];
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.iconImageView.mas_right).offset(2);
make.centerY.mas_equalTo(self.topicImageView);
make.left.right.mas_equalTo(self.topicImageView).inset(2);
make.bottom.mas_equalTo(self.topicImageView.mas_bottom).offset(-6);
}];
}
@@ -63,17 +63,19 @@
- (void)setTopicInfo:(MonentsTopicModel *)topicInfo {
_topicInfo = topicInfo;
if (_topicInfo) {
self.topicLabel.text = _topicInfo.name;
self.topicLabel.text = [NSString stringWithFormat:@"#%@", _topicInfo.name];
self.topicImageView.imageUrl = _topicInfo.icon;
}
}
- (UIImageView *)topicImageView {
- (NetImageView *)topicImageView {
if (!_topicImageView) {
_topicImageView = [[UIImageView alloc] init];
_topicImageView.userInteractionEnabled = YES;
_topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
NetImageConfig * config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_topicImageView = [[NetImageView alloc] initWithConfig:config];
_topicImageView.layer.masksToBounds = YES;
_topicImageView.layer.cornerRadius = 13;
_topicImageView.layer.cornerRadius = 12;
_topicImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _topicImageView;
}
@@ -82,7 +84,7 @@
if (!_iconImageView) {
_iconImageView = [[UIImageView alloc] init];
_iconImageView.userInteractionEnabled = YES;
_iconImageView.image = [UIImage imageNamed:@"monents_info_topic_icon"];
_iconImageView.image = [UIImage imageNamed:@"home_room_list_shadow_bg"];
}
return _iconImageView;
}
@@ -90,8 +92,9 @@
- (UILabel *)topicLabel {
if (!_topicLabel) {
_topicLabel = [[UILabel alloc] init];
_topicLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightBold];
_topicLabel.textColor = [ThemeColor mainTextColor];
_topicLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold];
_topicLabel.textColor = [UIColor whiteColor];
_topicLabel.textAlignment = NSTextAlignmentCenter;
}
return _topicLabel;
}

View File

@@ -59,8 +59,8 @@
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(12);
make.height.mas_equalTo(26);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(10);
make.height.mas_equalTo(77);
}];
}
@@ -70,9 +70,7 @@
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
MonentsTopicModel * topicModel = [self.topicList safeObjectAtIndex1:indexPath.row];
CGFloat itemWidth = [topicModel.name boundingRectWithSize:CGSizeMake(100, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10 weight:UIFontWeightBold]} context:nil].size.width;
return CGSizeMake(itemWidth + 39, 26);
return CGSizeMake(125, 77);
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {

View File

@@ -291,7 +291,7 @@
- (XPMonentsRecommendHeaderView *)headerView {
if (!_headerView) {
_headerView = [[XPMonentsRecommendHeaderView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 80)];
_headerView = [[XPMonentsRecommendHeaderView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 110)];
_headerView.delegate = self;
}
return _headerView;