Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f06178b8
由
cgx
编写于
2022-10-24 18:09:47 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
优化文章标签显示
1 个父辈
c9de7bfe
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
2 行删除
DreamSleep/DreamSleep/Class/CommunityModule/Article/ArticleCell.m
DreamSleep/DreamSleep/Class/CommunityModule/Article/ArticleCell.m
查看文件 @
f06178b
...
...
@@ -55,7 +55,17 @@
self
.
contentLab
.
text
=
model
.
content
;
[
self
.
coverIV
yy_setImageWithURL
:[
NSURL
URLWithString
:
model
.
cover
]
placeholder
:[
UIImage
defaultPlaceholderWithSize
:
CGSizeMake
(
86
,
86
)]];
// tag标签最多只有3个
NSArray
*
tagsTitleArr
=
model
.
tags
?
[
model
.
tags
componentsSeparatedByString
:
@"|"
]
:
@[];
NSArray
*
tagTitleColors
=
@[
BrandColor
];
NSArray
*
tagBgColors
=
@[
ColorFromHexA
(
0x62C3D5
,
.
2
)];
if
(
tagsTitleArr
.
count
==
2
)
{
tagTitleColors
=
@[
BrandColor
,
ColorFromHex
(
0x9377FC
)];
tagBgColors
=
@[
ColorFromHexA
(
0x62C3D5
,
.
2
),
ColorFromHexA
(
0x9377FC
,
.
2
)];
}
else
if
(
tagsTitleArr
.
count
==
3
)
{
tagTitleColors
=
@[
BrandColor
,
ColorFromHex
(
0x9377FC
),
ColorFromHex
(
0x5E9EFC
)];
tagBgColors
=
@[
ColorFromHexA
(
0x62C3D5
,
.
2
),
ColorFromHexA
(
0x9377FC
,
.
2
),
ColorFromHexA
(
0x5E9EFC
,
.
2
)];
}
[
self
.
tagsView
.
subviews
enumerateObjectsUsingBlock
:
^
(
__kindof
UIView
*
_Nonnull
obj
,
NSUInteger
idx
,
BOOL
*
_Nonnull
stop
)
{
[
obj
removeFromSuperview
];
}];
...
...
@@ -63,10 +73,10 @@
for
(
int
idx
=
0
;
idx
<
tagsTitleArr
.
count
;
idx
++
)
{
NSString
*
tagTitle
=
[
NSString
stringWithFormat
:
@"#%@"
,
tagsTitleArr
[
idx
]];
CGFloat
tagTitleW
=
[
UILabel
getWidthWithText
:
tagTitle
font
:
SysFont
(
12
)]
+
16
;
UILabel
*
tagLab
=
[
UILabel
labWithTextColor
:
BrandColor
font
:
SysFont
(
12
)];
UILabel
*
tagLab
=
[
UILabel
labWithTextColor
:
tagTitleColors
[
idx
]
font
:
SysFont
(
12
)];
tagLab
.
text
=
tagTitle
;
tagLab
.
textAlignment
=
NSTextAlignmentCenter
;
tagLab
.
backgroundColor
=
ColorFromHexA
(
0x62C3D5
,
.
2
)
;
tagLab
.
backgroundColor
=
tagBgColors
[
idx
]
;
[
tagLab
cornerRadius
:
10
.
5
];
tagLab
.
frame
=
CGRectMake
(
totalW
+
idx
*
8
,
0
,
tagTitleW
,
21
);
totalW
+=
tagTitleW
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论