Repository navigation
Expand file tree
/
Copy pathRefreshTableView.m
More file actions
49 lines (35 loc) · 1.6 KB
/
Copy pathRefreshTableView.m
File metadata and controls
49 lines (35 loc) · 1.6 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
//
// RefreshTableView.m
// 智慧工地
//
// Created by Fuqingping on 2017/4/13.
// Copyright © 2017年 ESCST. All rights reserved.
//
#import "RefreshTableView.h"
@interface RefreshTableView()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) NSString *cellModelName;
@end
@implementation RefreshTableView
-(instancetype)initWithRequestUrl:(NSString *)url paramters:(NSMutableDictionary *)paramters cellClassName:(NSString *)cellClassName modelClassName:(NSString *)modelClassName cellModelName:(NSString *)cellModelName{
if (self = [super initWithRequstUrl:url paramters:paramters cellClassName:cellClassName modelClassName:modelClassName]) {
_cellModelName = cellModelName;
self.delegate = self;
self.dataSource = self;
}
return self;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
id cell = [tableView dequeueReusableCellWithIdentifier:self.reuseId forIndexPath:indexPath];
[cell setValue:self.dataArray[indexPath.row] forKey:_cellModelName];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (_refreshDelegate&&[_refreshDelegate respondsToSelector:@selector(refreshTableView:didSelectRowAtIndexPath:)]) {
[_refreshDelegate refreshTableView:(RefreshTableView *)tableView didSelectRowAtIndexPath:indexPath];
}
}
@end