99#define kIconSize 90
1010#define kSwapBtnWidth 135
1111#define kLeftOffset 12
12+ #define kPinSize 18
1213
1314#import " ProjectAboutMeListCell.h"
1415
1516@interface ProjectAboutMeListCell ()
1617@property (nonatomic , strong ) Project *project;
17-
18- @property (nonatomic , strong ) UIImageView *projectIconView, *privateIconView;
18+ @property (nonatomic , strong ) UIImageView *projectIconView, *privateIconView, *pinIconView, *setCommonIconView;
1919@property (nonatomic , strong ) UILabel *projectTitleLabel;
2020@property (nonatomic , strong ) UILabel *ownerTitleLabel;
21+ @property (nonatomic , strong ) UILabel *describeLabel;
2122@end
2223
23-
2424@implementation ProjectAboutMeListCell
2525
2626- (id )initWithStyle : (UITableViewCellStyle)style reuseIdentifier : (NSString *)reuseIdentifier
2727{
2828 self = [super initWithStyle: style reuseIdentifier: reuseIdentifier];
2929 if (self) {
3030 // Initialization code
31- self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
3231 self.backgroundColor = [UIColor clearColor ];
3332 if (!_projectIconView) {
3433 _projectIconView = [[UIImageView alloc ] initWithFrame: CGRectMake (kLeftOffset , 10 , kIconSize , kIconSize )];
@@ -49,23 +48,45 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4948 _ownerTitleLabel.font = [UIFont systemFontOfSize: 15 ];
5049 [self .contentView addSubview: _ownerTitleLabel];
5150 }
51+ if (!_describeLabel) {
52+ _describeLabel = [UILabel new ];
53+ _describeLabel.textColor = [UIColor colorWithHexString: @" 0x666666" ];
54+ _describeLabel.font = [UIFont systemFontOfSize: 14 ];
55+ _describeLabel.numberOfLines =2 ;
56+ [self .contentView addSubview: _describeLabel];
57+ }
58+
5259 if (!_privateIconView) {
5360 _privateIconView = [[UIImageView alloc ] initWithImage: [UIImage imageNamed: @" icon_project_private" ]];
5461 _privateIconView.hidden = YES ;
5562 [self .contentView addSubview: _privateIconView];
5663 }
5764
58- [_projectTitleLabel mas_makeConstraints: ^(MASConstraintMaker *make) {
59- make.top .equalTo (_projectIconView.mas_top );
60- make.height .equalTo (@(25 ));
61- make.left .equalTo (_privateIconView.mas_right ).offset (8 );
62- make.right .lessThanOrEqualTo (self.mas_right );
63- }];
65+ if (!_pinIconView) {
66+ _pinIconView = [[UIImageView alloc ] initWithImage: [UIImage imageNamed: @" icon_project_cell_pin" ]];
67+ _pinIconView.hidden = YES ;
68+ [self .contentView addSubview: _pinIconView];
69+ [_pinIconView mas_makeConstraints: ^(MASConstraintMaker *make) {
70+ make.size .mas_equalTo (CGSizeMake (kPinSize , kPinSize ));
71+ make.left .equalTo (self.projectIconView ).offset (5 );
72+ make.top .equalTo (self.projectIconView ).offset (6 );
73+ }];
74+ }
6475
65- [_ownerTitleLabel mas_makeConstraints: ^(MASConstraintMaker *make) {
66- make.left .right .height .equalTo (self.projectTitleLabel );
67- make.bottom .equalTo (_projectIconView.mas_bottom );
68- }];
76+ if (!_setCommonIconView) {
77+ _setCommonIconView = [[UIImageView alloc ] initWithImage: [UIImage imageNamed: @" " ]];
78+ _setCommonIconView.hidden = YES ;
79+ // for test
80+ _setCommonIconView.backgroundColor =[UIColor greenColor ];
81+ [self .contentView addSubview: _setCommonIconView];
82+ [_setCommonIconView mas_makeConstraints: ^(MASConstraintMaker *make) {
83+ make.size .mas_equalTo (CGSizeMake (13 , 3 ));
84+ make.right .equalTo (self).offset (-15 );
85+ make.bottom .equalTo (self.projectIconView );
86+ }];
87+ }
88+
89+
6990 }
7091 return self;
7192}
@@ -85,9 +106,31 @@ - (void)setProject:(Project *)project hasSWButtons:(BOOL)hasSWButtons hasBadgeTi
85106 make.left .equalTo (_projectIconView.mas_right ).offset (kLeftOffset );
86107 }];
87108
88- // Title & UserName
109+ [_projectTitleLabel mas_updateConstraints: ^(MASConstraintMaker *make) {
110+ make.top .equalTo (_projectIconView.mas_top );
111+ make.height .equalTo (@(25 ));
112+ make.left .equalTo (_privateIconView.mas_right ).offset (_privateIconView.hidden ?0 :8 );
113+ make.right .lessThanOrEqualTo (self.mas_right );
114+ }];
115+
116+ [_ownerTitleLabel mas_updateConstraints: ^(MASConstraintMaker *make) {
117+ make.right .height .equalTo (self.projectTitleLabel );
118+ make.left .equalTo (self.privateIconView );
119+ make.bottom .equalTo (_projectIconView.mas_bottom );
120+ }];
121+
122+ [_describeLabel mas_updateConstraints: ^(MASConstraintMaker *make) {
123+ make.left .equalTo (self.privateIconView );
124+ make.height .equalTo (@(40 ));
125+ make.width .equalTo (@(kScreen_Width -kLeftOffset -kIconSize -kLeftOffset ));
126+ make.top .equalTo (_projectTitleLabel.mas_bottom );
127+ }];
128+
129+
130+ // Title & UserName & description
89131 _projectTitleLabel.text = _project.name ;
90132 _ownerTitleLabel.text = _project.owner_user_name ;
133+ _describeLabel.text =_project.description_mine ;
91134
92135 // hasSWButtons
93136 [self setRightUtilityButtons: hasSWButtons? [self rightButtons ]: nil
@@ -110,14 +153,16 @@ - (void)setProject:(Project *)project hasSWButtons:(BOOL)hasSWButtons hasBadgeTi
110153
111154 // hasIndicator
112155 self.accessoryType = hasIndicator? UITableViewCellAccessoryDisclosureIndicator: UITableViewCellAccessoryNone;
156+ _pinIconView.hidden =!_project.pin .boolValue ;
157+ _setCommonIconView.hidden =!hasBadgeTip;
113158}
114159
115160- (NSArray *)rightButtons {
116161 NSMutableArray *rightUtilityButtons = [NSMutableArray new ];
117162 // [rightUtilityButtons sw_addUtilityButtonWithColor:[UIColor colorWithHexString:_project.pin.boolValue? @"0xe6e6e6": @"0x3bbd79"]
118163 // icon:[UIImage imageNamed:_project.pin.boolValue? @"icon_project_cell_pin": @"icon_project_cell_nopin"]];
119164
120- [rightUtilityButtons sw_addUtilityButtonWithColor: [UIColor colorWithHexString: _project.pin.boolValue? @" 0xe6e6e6 " : @" 0x3bbd79" ]
165+ [rightUtilityButtons sw_addUtilityButtonWithColor: [UIColor colorWithHexString: _project.pin.boolValue? @" 0xeeeeee " : @" 0x3bbd79" ]
121166 title: _project.pin.boolValue?@" 取消常用" :@" 设置常用" titleColor: [UIColor colorWithHexString: _project.pin.boolValue?@" 0x3bbd79" :@" 0xffffff" ]];
122167
123168 return rightUtilityButtons;
0 commit comments