Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SearchCategoryCell.m « Classes « Maps « iphone - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f36f88d85efe06c2398441fd1676bb09238e3f2 (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

#import "SearchCategoryCell.h"
#import "UIColor+MapsMeColor.h"
#import "UIKitCategories.h"

@interface SearchCategoryCell ()

@property (nonatomic) UIImageView * iconImageView;

@end

@implementation SearchCategoryCell

- (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, 0, 0, 24);
  self.titleLabel.textColor = [UIColor blackPrimaryText];
}

- (void)layoutSubviews
{
  [super layoutSubviews];

  CGFloat const offsetL = 56;
  self.titleLabel.origin = CGPointMake(offsetL, 8);
  self.titleLabel.width = self.width - self.titleLabel.minX - 20;
  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 - offsetL;
  self.separatorView.minX = offsetL;
}

+ (CGFloat)cellHeight
{
  return 44;
}

- (UIImageView *)iconImageView
{
  if (!_iconImageView)
  {
    _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 9, 25, 25)];
    _iconImageView.contentMode = UIViewContentModeCenter;
  }
  return _iconImageView;
}

@end