修改了动态的话题的UI
This commit is contained in:
@@ -11,13 +11,14 @@
|
|||||||
///Tool
|
///Tool
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
|
#import "NetImageView.h"
|
||||||
///Model
|
///Model
|
||||||
#import "MonentsTopicModel.h"
|
#import "MonentsTopicModel.h"
|
||||||
|
|
||||||
@interface XPMonentsTopicCollectionViewCell ()
|
@interface XPMonentsTopicCollectionViewCell ()
|
||||||
|
|
||||||
///背景
|
///背景
|
||||||
@property (nonatomic,strong) UIImageView *topicImageView;
|
@property (nonatomic,strong) NetImageView *topicImageView;
|
||||||
///显示话题前面的#
|
///显示话题前面的#
|
||||||
@property (nonatomic,strong) UIImageView *iconImageView;
|
@property (nonatomic,strong) UIImageView *iconImageView;
|
||||||
///显示话题
|
///显示话题
|
||||||
@@ -48,14 +49,13 @@
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.mas_equalTo(self.topicImageView).offset(7);
|
make.left.right.bottom.mas_equalTo(self.topicImageView);
|
||||||
make.size.mas_equalTo(CGSizeMake(25, 25));
|
make.height.mas_equalTo(30);
|
||||||
make.centerY.mas_equalTo(self.topicImageView);
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.mas_equalTo(self.iconImageView.mas_right).offset(2);
|
make.left.right.mas_equalTo(self.topicImageView).inset(2);
|
||||||
make.centerY.mas_equalTo(self.topicImageView);
|
make.bottom.mas_equalTo(self.topicImageView.mas_bottom).offset(-6);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,17 +63,19 @@
|
|||||||
- (void)setTopicInfo:(MonentsTopicModel *)topicInfo {
|
- (void)setTopicInfo:(MonentsTopicModel *)topicInfo {
|
||||||
_topicInfo = topicInfo;
|
_topicInfo = topicInfo;
|
||||||
if (_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) {
|
if (!_topicImageView) {
|
||||||
_topicImageView = [[UIImageView alloc] init];
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
_topicImageView.userInteractionEnabled = YES;
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
_topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
_topicImageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
_topicImageView.layer.masksToBounds = YES;
|
_topicImageView.layer.masksToBounds = YES;
|
||||||
_topicImageView.layer.cornerRadius = 13;
|
_topicImageView.layer.cornerRadius = 12;
|
||||||
|
_topicImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||||
}
|
}
|
||||||
return _topicImageView;
|
return _topicImageView;
|
||||||
}
|
}
|
||||||
@@ -82,7 +84,7 @@
|
|||||||
if (!_iconImageView) {
|
if (!_iconImageView) {
|
||||||
_iconImageView = [[UIImageView alloc] init];
|
_iconImageView = [[UIImageView alloc] init];
|
||||||
_iconImageView.userInteractionEnabled = YES;
|
_iconImageView.userInteractionEnabled = YES;
|
||||||
_iconImageView.image = [UIImage imageNamed:@"monents_info_topic_icon"];
|
_iconImageView.image = [UIImage imageNamed:@"home_room_list_shadow_bg"];
|
||||||
}
|
}
|
||||||
return _iconImageView;
|
return _iconImageView;
|
||||||
}
|
}
|
||||||
@@ -90,8 +92,9 @@
|
|||||||
- (UILabel *)topicLabel {
|
- (UILabel *)topicLabel {
|
||||||
if (!_topicLabel) {
|
if (!_topicLabel) {
|
||||||
_topicLabel = [[UILabel alloc] init];
|
_topicLabel = [[UILabel alloc] init];
|
||||||
_topicLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightBold];
|
_topicLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold];
|
||||||
_topicLabel.textColor = [ThemeColor mainTextColor];
|
_topicLabel.textColor = [UIColor whiteColor];
|
||||||
|
_topicLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
}
|
}
|
||||||
return _topicLabel;
|
return _topicLabel;
|
||||||
}
|
}
|
||||||
|
@@ -59,8 +59,8 @@
|
|||||||
|
|
||||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.mas_equalTo(self);
|
make.left.right.mas_equalTo(self);
|
||||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(12);
|
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(10);
|
||||||
make.height.mas_equalTo(26);
|
make.height.mas_equalTo(77);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,9 +70,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
MonentsTopicModel * topicModel = [self.topicList safeObjectAtIndex1:indexPath.row];
|
return CGSizeMake(125, 77);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
@@ -291,7 +291,7 @@
|
|||||||
|
|
||||||
- (XPMonentsRecommendHeaderView *)headerView {
|
- (XPMonentsRecommendHeaderView *)headerView {
|
||||||
if (!_headerView) {
|
if (!_headerView) {
|
||||||
_headerView = [[XPMonentsRecommendHeaderView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 80)];
|
_headerView = [[XPMonentsRecommendHeaderView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 110)];
|
||||||
_headerView.delegate = self;
|
_headerView.delegate = self;
|
||||||
}
|
}
|
||||||
return _headerView;
|
return _headerView;
|
||||||
|
Reference in New Issue
Block a user