forked from draveness/DKNightVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableViewCell.m
More file actions
59 lines (46 loc) · 2.07 KB
/
TableViewCell.m
File metadata and controls
59 lines (46 loc) · 2.07 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// TableViewCell.m
// DKNightVersion
//
// Created by Draveness on 5/1/15.
// Copyright (c) 2015 Draveness. All rights reserved.
//
#import "TableViewCell.h"
#import <DKNightVersion/DKNightVersion.h>
@interface TableViewCell ()
@end
@implementation TableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.label = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, 270, 80)];
self.label.numberOfLines = 0;
self.label.text = @"DKNightVersion is a light weight framework adding night mode to your iOS app.";
self.label.textColor = [UIColor darkGrayColor];
self.label.lineBreakMode = NSLineBreakByCharWrapping;
[self.contentView addSubview:self.label];
CGRect rect = CGRectMake(250, 10, 120, 80);
self.button = [[UIButton alloc] initWithFrame:rect];
self.button.titleLabel.font = [UIFont systemFontOfSize:20];
[self.button setTitleColor:[UIColor colorWithRed:0.478 green:0.651 blue:0.988 alpha:1.0] forState:UIControlStateNormal];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.button];
// self.contentView.dk_backgroundColorPicker = DKColorPickerWithKey(BG);
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(300, 25, 50, 50)];
imageView.dk_imagePicker = DKImagePickerWithNames(@"normal1", @"night1", @"normal1");
[self.contentView addSubview:imageView];
}
return self;
}
- (void)setCellTintColor:(UIColor *)cellTintColor {
_cellTintColor = cellTintColor;
self.contentView.backgroundColor = _cellTintColor;
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
if (highlighted) {
self.contentView.dk_backgroundColorPicker = DKColorPickerWithKey(HIGHLIGHTED);
} else {
self.contentView.dk_backgroundColorPicker = DKColorPickerWithKey(BG);
}
}
@end