blob: 5d3b03ddc56f09a212f96161e4fcbdd1c00aa6f4 (
plain)
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
|
#import "SearchSuggestCell.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
#import "UIKitCategories.h"
@interface SearchSuggestCell ()
@property (nonatomic) UIImageView * iconImageView;
@end
@implementation SearchSuggestCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.iconImageView];
}
return self;
}
- (void)configTitleLabel
{
[super configTitleLabel];
self.titleLabel.frame = CGRectMake(0., INTEGRAL(8.5), 0, 24);
self.titleLabel.textColor = [UIColor primary];
}
- (NSDictionary *)selectedTitleAttributes
{
static NSDictionary * selectedAttributes;
if (!selectedAttributes)
selectedAttributes = @{NSForegroundColorAttributeName : [UIColor primary], NSFontAttributeName : [UIFont bold16]};
return selectedAttributes;
}
- (NSDictionary *)unselectedTitleAttributes
{
static NSDictionary * unselectedAttributes;
if (!unselectedAttributes)
unselectedAttributes = @{NSForegroundColorAttributeName : [UIColor primary], NSFontAttributeName : [UIFont regular16]};
return unselectedAttributes;
}
- (void)layoutSubviews
{
[super layoutSubviews];
CGFloat const offset = 34.;
self.titleLabel.minX = offset;
self.titleLabel.width = self.width - self.titleLabel.minX - offset;
self.titleLabel.center = CGPointMake(self.titleLabel.center.x, self.height / 2.);
self.iconImageView.center = CGPointMake(self.iconImageView.center.x, self.titleLabel.center.y);
self.separatorView.width = self.width - 16.;
self.separatorView.minX = 16.;
}
+ (CGFloat)cellHeight
{
return 44;
}
- (UIImageView *)iconImageView
{
if (!_iconImageView)
{
_iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 14, 12, 12)];
_iconImageView.image = [UIImage imageNamed:@"ic_suggest"];
_iconImageView.contentMode = UIViewContentModeCenter;
}
return _iconImageView;
}
@end
|