-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFFBaseCell.m
More file actions
110 lines (91 loc) · 2.93 KB
/
FFBaseCell.m
File metadata and controls
110 lines (91 loc) · 2.93 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//
// FFBaseCell.m
// prophets-ios
//
// Created by Benjamin Roesch on 10/10/12.
// Copyright (c) 2012 Benjamin Roesch. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
#import "FFBaseCell.h"
#import "UIColor+Additions.h"
@interface FFBaseCell ()
@property (nonatomic, strong) CALayer *mask;
@property (nonatomic) FFCellLocationInSection currentShadowLocation;
@end
@implementation FFBaseCell
-(void)awakeFromNib{
[super awakeFromNib];
self.backgroundColor = [UIColor creamColor];
/*
[self.layer setShadowOffset:CGSizeMake(1, 1)];
[self.layer setShadowOpacity:0.8];
[self.layer setShadowRadius:3];
[self.layer setShadowColor:[[UIColor blackColor] CGColor]];
self.mask = [CALayer layer];
self.mask.backgroundColor = [UIColor blackColor].CGColor;
self.layer.mask = self.mask;
*/
//[self.layer setShadowColor:[[UIColor blackColor] CGColor]];
}
/*
-(void)setShowsBottomShadow:(BOOL)show{
if (_showsBottomShadow == show) return;
_showsBottomShadow = show;
if (show) {
[self.layer setShadowOffset:CGSizeMake(0, 1)];
[self.layer setShadowOpacity:0.8];
[self.layer setShadowRadius:2];
}
else{
[self.layer setShadowOffset:CGSizeMake(0, 0)];
[self.layer setShadowOpacity:0];
[self.layer setShadowRadius:0];
}
}
*/
-(void)setShowsAccessoryView:(BOOL)val{
_showsAccessoryView = val;
if(val)
self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"table_cell_arrow.png"]];
else
self.accessoryView = nil;
}
/*
- (void) drawRect:(CGRect)initialRect {
[super drawRect:initialRect];
[self setShadows];
}
*/
/*
-(void)setShadows{
FFCellLocationInSection location = [self locationInSection];
if(location == self.currentShadowLocation) return;
self.currentShadowLocation = location;
if (location == FFCellTop) {
self.mask.frame = CGRectMake(-4.0, -4.0, self.bounds.size.width + 4, self.bounds.size.height+4);
}
else if (location == FFCellMiddle){
self.mask.frame = CGRectMake(-4.0, 0.0, self.bounds.size.width + 4, self.bounds.size.height);
}
else if (location == FFCellBottom){
self.mask.frame = CGRectMake(-4.0, 0.0, self.bounds.size.width + 4, self.bounds.size.height+6);
}
else if (location == FFCellSingle){
self.mask.frame = CGRectMake(-4.0, -4.0, self.bounds.size.width + 4, self.bounds.size.height+9);
}
}
-(FFCellLocationInSection)locationInSection{
UITableView *tableView = (UITableView *)self.superview;
NSIndexPath *indexPath = [tableView indexPathForCell:self];
NSInteger numRows = [tableView numberOfRowsInSection:indexPath.section];
if (numRows == 1)
return FFCellSingle;
else if (indexPath.row == 0)
return FFCellTop;
else if (indexPath.row == numRows-1)
return FFCellBottom;
else
return FFCellMiddle;
}
*/
@end