FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Coding-iOS/Coding_iOS/Controllers/Topic/CSTopicHeaderView.m at master · iFlyCai/Coding-iOS · GitHub
iFlyCai
/
Coding-iOS
Public
forked from
coding/Coding-iOS
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Controllers
/
Topic
/
CSTopicHeaderView.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
114 lines (93 loc) · 3.83 KB
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Controllers
/
Topic
/
CSTopicHeaderView.m
Copy path
File metadata and controls
114 lines (93 loc) · 3.83 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//
//
CSTopicUsersCell.m
//
Coding_iOS
//
//
Created by pan Shiyu on 15/7/27.
//
Copyright (c) 2015年 Coding. All rights reserved.
//
#
import
"
CSTopicHeaderView.h
"
#
import
"
Coding_NetAPIManager.h
"
#
import
"
User.h
"
#
import
"
CSLikesVC.h
"
@interface
CSTopicHeaderView
()
@property
(
nonatomic
,
strong
)
NSDictionary
*refTopic;
//
@property (nonatomic,strong)UIButton *rightBtn;
@property
(
nonatomic
,
strong
)
NSMutableArray
*avatalist;
@property
(
nonatomic
,
assign
)
BOOL
watched;
@end
@implementation
CSTopicHeaderView
{
//
UILabel *_nameLabel;
UILabel *_userCountLabel;
}
- (
id
)
initWithFrame
:
(CGRect)
frame
{
self = [
super
initWithFrame:
frame];
if
(self) {
self.
backgroundColor
= [UIColor
whiteColor
];
self.
clipsToBounds
=
YES
;
UIView *sepLine = [[UIView
alloc
]
initWithFrame:
CGRectMake
(
12
,
41
,
kScreen_Width
-
12
,
0.5
)];
sepLine.
backgroundColor
=
kColorDDD
;
[
self
addSubview:
sepLine];
_userCountLabel = ({
UILabel *label1 = [[UILabel
alloc
]
initWithFrame:
CGRectMake
(
12
,
15
,
150
,
15
)];
label1.
font
= [UIFont
systemFontOfSize:
13
];
label1.
backgroundColor
= [UIColor
clearColor
];
label1.
textColor
= [UIColor
colorWithHexString:
@"
0x333333
"
];
label1.
textAlignment
= NSTextAlignmentLeft;
[
self
addSubview:
label1];
label1;
});
UILabel *label2 = [[UILabel
alloc
]
initWithFrame:
CGRectMake
(
0
,
15
,
100
,
15
)];
label2.
right
=
kScreen_Width
-
25
;
label2.
font
= [UIFont
systemFontOfSize:
13
];
label2.
backgroundColor
= [UIColor
clearColor
];
label2.
textColor
=
kColor999
;
label2.
textAlignment
= NSTextAlignmentRight;
label2.
text
=
@"
查看全部
"
;
[
self
addSubview:
label2];
UIImageView *arrow = [[UIImageView
alloc
]
initWithImage:
[UIImage
imageNamed:
@"
task_icon_arrow
"
]];
arrow.
centerY
= label2.
centerY
;
arrow.
right
=
kScreen_Width
-
12
;
[
self
addSubview:
arrow];
UIButton *btn = [[UIButton
alloc
]
initWithFrame:
CGRectMake
(
0
,
0
,
kScreen_Width
,
42
)];
btn.
backgroundColor
= [UIColor
clearColor
];
[btn
addTarget:
self
action:
@selector
(
goAllUsers
)
forControlEvents:
UIControlEventTouchUpInside];
[
self
addSubview:
btn];
_avatalist =
nil
;
}
return
self;
}
- (
void
)
goAllUsers
{
CSLikesVC *vc = [[CSLikesVC
alloc
]
init
];
vc.
topicID
= [
self
.refTopic[
@"
id
"
]intValue];
[
self
.parentVC.navigationController
pushViewController:
vc
animated:
YES
];
}
- (
void
)
updateWithTopic
:
(
NSDictionary
*)
data
{
_refTopic = data;
_userCountLabel.
text
= [
NSString
stringWithFormat:
@"
%@
人参与
"
,data[
@"
speackers
"
]];
}
- (
void
)
updateWithJoinedUsers
:
(
NSArray
*)
userlist
{
if
(!_avatalist) {
_avatalist = [
NSMutableArray
array
];
for
(
int
i=
0
; i<userlist.
count
; i++) {
User *user = userlist[i];
UIImageView *iconView = [[YLImageView
alloc
]
initWithFrame:
CGRectMake
(
0
,
57
,
42
,
42
)];
[iconView
doCircleFrame
];
iconView.
left
=
16
+ i *(
9
+
42
);
if
(iconView.
right
>
kScreen_Width
) {
break
;
}
[
self
addSubview:
iconView];
[iconView
sd_setImageWithURL:
[user.avatar
urlImageWithCodePathResizeToView:
iconView]
placeholderImage:
[UIImage
imageNamed:
@"
placeholder_monkey_round_48
"
]];
{
UIImageView *vipV = [UIImageView
new
];
[
self
addSubview:
vipV];
[vipV
mas_makeConstraints:
^(MASConstraintMaker *make) {
make.
right
.
bottom
.
equalTo
(iconView);
}];
vipV.
image
= [UIImage
imageNamed:
[
NSString
stringWithFormat:
@"
vip_
%@
_40
"
, user.vip]];
}
[_avatalist
addObject:
iconView];
}
}
}
@end
Back
|
FazBrowse Home
|
New Git URL