blob: 0b16e4322d5829ded4ad730b24fbe05b9660289d (
plain) (
blame)
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
|
//
// NavCell.m
// Juick
//
// Created by Vitaly on 17.12.13.
// Copyright (c) 2013 com.juick. All rights reserved.
//
#import "NavCell.h"
@interface NavCell ()
@property (nonatomic, assign) BOOL didSetupConstraints;
@end
@implementation NavCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor blackColor];
self.iconLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.descriptionTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
[self.contentView addSubview:self.iconLabel];
[self.contentView addSubview:self.descriptionTextLabel];
}
return self;
}
- (void)updateConstraints {
[super updateConstraints];
if (self.didSetupConstraints) return;
[self.iconLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.left).with.offset(20.f);
make.top.equalTo(self.contentView.top).with.offset(10.f);
make.width.equalTo(@36);
make.height.equalTo(@36);
}];
[self.descriptionTextLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconLabel.right).with.offset(10.f);
make.top.equalTo(self.contentView.top).with.offset(15.f);
make.right.equalTo(self.contentView.right).with.offset(-20.f);
}];
self.didSetupConstraints = YES;
}
@end
|