-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathEditLabelCell.m
53 lines (45 loc) · 1.57 KB
/
EditLabelCell.m
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
//
// EditLabelCell.m
// Coding_iOS
//
// Created by zwm on 15/4/16.
// Copyright (c) 2015年 Coding. All rights reserved.
//
#import "EditLabelCell.h"
#import "ProjectTagLabel.h"
@interface EditLabelCell ()
@property (strong, nonatomic) ProjectTagLabel *nameLbl;
@end
@implementation EditLabelCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.accessoryType = UITableViewCellAccessoryNone;
self.backgroundColor = kColorTableBG;
if (!_selectBtn) {
_selectBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreen_Width - kPaddingLeftWidth - 24, 10, 24, 24)];
[_selectBtn setImage:[UIImage imageNamed:@"tag_select_no"] forState:UIControlStateNormal];
[_selectBtn setImage:[UIImage imageNamed:@"tag_select"] forState:UIControlStateSelected];
_selectBtn.userInteractionEnabled = NO;
[self.contentView addSubview:_selectBtn];
}
}
return self;
}
- (void)setTag:(ProjectTag *)curTag andSelected:(BOOL)selected{
if (_nameLbl) {
_nameLbl.curTag = curTag;
}else{
_nameLbl = [ProjectTagLabel labelWithTag:curTag font:[UIFont systemFontOfSize:12] height:20 widthPadding:10];
[_nameLbl setOrigin:CGPointMake(kPaddingLeftWidth, ([EditLabelCell cellHeight] - 22)/2)];
[self.contentView addSubview:_nameLbl];
}
_selectBtn.selected = selected;
}
+ (CGFloat)cellHeight
{
return 44.0;
}
@end