This repository was archived by the owner on Mar 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathUIBubbleHeaderTableViewCell.m
More file actions
58 lines (45 loc) · 1.51 KB
/
UIBubbleHeaderTableViewCell.m
File metadata and controls
58 lines (45 loc) · 1.51 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
//
// UIBubbleHeaderTableViewCell.m
// UIBubbleTableViewExample
//
// Created by Александр Баринов on 10/7/12.
// Copyright (c) 2012 Stex Group. All rights reserved.
//
#import "UIBubbleHeaderTableViewCell.h"
@interface UIBubbleHeaderTableViewCell ()
@property (nonatomic, retain) UILabel *label;
@end
@implementation UIBubbleHeaderTableViewCell
@synthesize label = _label;
@synthesize date = _date;
+ (CGFloat)height
{
return 28.0;
}
- (void)setDate:(NSDate *)value
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSString *text = [dateFormatter stringFromDate:value];
#if !__has_feature(objc_arc)
[dateFormatter release];
#endif
if (self.label)
{
self.label.text = text;
return;
}
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, [UIBubbleHeaderTableViewCell height])];
self.label.text = text;
self.label.font = [UIFont boldSystemFontOfSize:12];
self.label.textAlignment = NSTextAlignmentCenter;
self.label.shadowOffset = CGSizeMake(0, 1);
self.label.shadowColor = [UIColor whiteColor];
self.label.textColor = [UIColor darkGrayColor];
self.label.backgroundColor = [UIColor clearColor];
self.label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self addSubview:self.label];
}
@end