forked from erichoracek/MSCollectionViewCalendarLayout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMSTimeRowHeader.m
More file actions
46 lines (38 loc) · 1.08 KB
/
Copy pathMSTimeRowHeader.m
File metadata and controls
46 lines (38 loc) · 1.08 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
//
// MSTimeRowHeader.m
// Example
//
// Created by Eric Horacek on 2/26/13.
// Copyright (c) 2013 Monospace Ltd. All rights reserved.
//
#import "MSTimeRowHeader.h"
@implementation MSTimeRowHeader
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.title = [UILabel new];
self.title.backgroundColor = [UIColor clearColor];
self.title.font = [UIFont systemFontOfSize:12.0];
[self addSubview:self.title];
[self.title makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.centerY);
make.right.equalTo(self.right).offset(-5.0);
}];
}
return self;
}
#pragma mark - MSTimeRowHeader
- (void)setTime:(NSDate *)time
{
_time = time;
static NSDateFormatter *dateFormatter;
if (!dateFormatter) {
dateFormatter = [NSDateFormatter new];
dateFormatter.dateFormat = @"h a";
}
self.title.text = [dateFormatter stringFromDate:time];
[self setNeedsLayout];
}
@end