-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathTDAlternateIconCell.m
More file actions
37 lines (27 loc) · 1.55 KB
/
TDAlternateIconCell.m
File metadata and controls
37 lines (27 loc) · 1.55 KB
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
#import "TDAlternateIconCell.h"
@implementation TDAlternateIconCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_iconImageView = [[UIImageView alloc] init];
_iconNameLabel = [[UILabel alloc] init];
_iconImageView.translatesAutoresizingMaskIntoConstraints = NO;
_iconImageView.layer.masksToBounds = YES;
_iconImageView.layer.cornerRadius = 15.0;
_iconNameLabel.translatesAutoresizingMaskIntoConstraints = NO;
_iconNameLabel.font = [UIFont systemFontOfSize:17.0 weight:UIFontWeightSemibold];
[self.contentView addSubview:_iconImageView];
[self.contentView addSubview:_iconNameLabel];
[NSLayoutConstraint activateConstraints:@[
[_iconImageView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor constant:15.0],
[_iconImageView.centerYAnchor constraintEqualToAnchor:self.contentView.centerYAnchor],
[_iconImageView.widthAnchor constraintEqualToConstant:60],
[_iconImageView.heightAnchor constraintEqualToConstant:60],
[_iconNameLabel.leadingAnchor constraintEqualToAnchor:_iconImageView.trailingAnchor constant:15.0],
[_iconNameLabel.centerYAnchor constraintEqualToAnchor:self.contentView.centerYAnchor],
[_iconNameLabel.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor constant:-15.0],
]];
}
return self;
}
@end