77//
88
99#import " EditLabelCell.h"
10+ #import " ProjectTagLabel.h"
1011
1112@interface EditLabelCell ()
13+ @property (strong , nonatomic ) ProjectTagLabel *nameLbl;
1214@end
1315
1416@implementation EditLabelCell
@@ -17,15 +19,10 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
1719{
1820 self = [super initWithStyle: style reuseIdentifier: reuseIdentifier];
1921 if (self) {
20- self.accessoryType = UITableViewCellAccessoryNone;
21- self.backgroundColor = [UIColor clearColor ];
2222 // Initialization code
23- if (!_nameLbl) {
24- _nameLbl = [[UILabel alloc ] initWithFrame: CGRectMake (kPaddingLeftWidth , 0 , (kScreen_Width - kPaddingLeftWidth * 2 - 30 ), 44 )];
25- _nameLbl.textColor = [UIColor colorWithHexString: @" 0x222222" ];
26- _nameLbl.font = [UIFont systemFontOfSize: 16 ];
27- [self .contentView addSubview: _nameLbl];
28- }
23+ self.accessoryType = UITableViewCellAccessoryNone;
24+ self.backgroundColor = kColorTableBG ;
25+
2926 if (!_selectBtn) {
3027 _selectBtn = [[UIButton alloc ] initWithFrame: CGRectMake (kScreen_Width - kPaddingLeftWidth - 24 , 10 , 24 , 24 )];
3128 [_selectBtn setImage: [UIImage imageNamed: @" tag_select_no" ] forState: UIControlStateNormal];
@@ -37,31 +34,15 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3734 return self;
3835}
3936
40- - (void )layoutSubviews
41- {
42- [super layoutSubviews ];
43- }
44-
45- - (void )resetLbl
46- {
47- // _nameLbl.frame = CGRectMake(kPaddingLeftWidth, 0, (kScreen_Width - kPaddingLeftWidth * 2 - 30), 44);
48- // _selectBtn.hidden = FALSE;
49- }
50-
51- - (void )showRightBtn : (BOOL )show
52- {
53- // if (show) {
54- // _selectBtn.hidden = show;
55- // [UIView animateWithDuration:0.1 animations:^{
56- // _nameLbl.frame = CGRectMake(kPaddingLeftWidth + 88, 0, (kScreen_Width - kPaddingLeftWidth * 2 - 30 - 88), 44);
57- // }];
58- // } else {
59- // [UIView animateWithDuration:0.1 animations:^{
60- // _nameLbl.frame = CGRectMake(kPaddingLeftWidth, 0, (kScreen_Width - kPaddingLeftWidth * 2 - 30), 44);
61- // } completion:^(BOOL finished) {
62- // _selectBtn.hidden = show;
63- // }];
64- // }
37+ - (void )setTag : (ProjectTag *)curTag andSelected : (BOOL )selected {
38+ if (_nameLbl) {
39+ _nameLbl.curTag = curTag;
40+ }else {
41+ _nameLbl = [ProjectTagLabel labelWithRag: curTag font: [UIFont systemFontOfSize: 12 ] height: 20 widthPadding: 10 ];
42+ [_nameLbl setOrigin: CGPointMake (kPaddingLeftWidth , ([EditLabelCell cellHeight ] - 22 )/2 )];
43+ [self .contentView addSubview: _nameLbl];
44+ }
45+ _selectBtn.selected = selected;
6546}
6647
6748+ (CGFloat)cellHeight
0 commit comments