diff --git a/xplan-ios/Main/Monents/View/Cell/XPMonentsTopicCollectionViewCell.m b/xplan-ios/Main/Monents/View/Cell/XPMonentsTopicCollectionViewCell.m index a76dca31..4bb0712b 100644 --- a/xplan-ios/Main/Monents/View/Cell/XPMonentsTopicCollectionViewCell.m +++ b/xplan-ios/Main/Monents/View/Cell/XPMonentsTopicCollectionViewCell.m @@ -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; } diff --git a/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m b/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m index 1ec32572..def32bad 100644 --- a/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m +++ b/xplan-ios/Main/Monents/View/SubViews/XPMonentsRecommendHeaderView.m @@ -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 { diff --git a/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m b/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m index be5ab76c..2886d651 100644 --- a/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m +++ b/xplan-ios/Main/Monents/View/XPMonentsRecommendViewController.m @@ -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;