-
Notifications
You must be signed in to change notification settings - Fork 0
/
TableViewData.m
52 lines (41 loc) · 1.08 KB
/
TableViewData.m
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
//
// TableViewData.m
// XReader
//
// Created by Pablo Collins on 1/30/11.
//
#import "TableViewData.h"
#import "TableViewSection.h"
@implementation TableViewData
- (id)init {
self = [super init];
sections = [[NSMutableArray alloc] init];
return self;
}
- (void)addSection:(TableViewSection *)s {
[sections addObject:s];
}
- (NSInteger)numberOfSections {
return [sections count];
}
- (NSString *)titleForHeaderInSection:(NSInteger)section {
TableViewSection *s = [sections objectAtIndex:section];
return s.title;
}
- (NSString *)titleForFooterInSection:(NSInteger)section {
TableViewSection *s = [sections objectAtIndex:section];
return s.footerTitle;
}
- (NSInteger)numberOfRowsInSection:(NSInteger)section {
TableViewSection *s = [self section:section];
return [s rowCount];
}
- (TableViewSection *)section:(NSInteger)section {
return [sections objectAtIndex:section];
}
- (TableViewRow *)rowAtIndexPath:(NSIndexPath *)indexPath
{
TableViewSection *s = [self section:[indexPath section]];
return [s rowAtIndex:[indexPath row]];
}
@end