Skip to content

Commit ca9b261

Browse files
committed
实战使用
1 parent d2a8238 commit ca9b261

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

KtTableView/KtTableView/KTMainViewController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
//
88

99
#import <UIKit/UIKit.h>
10+
#import "KtBaseTableView.h"
1011

1112
@interface KTMainViewController : UIViewController
1213

13-
@property (nonatomic, strong) UITableView *tableView;
14+
@property (nonatomic, strong) KtBaseTableView *tableView;
1415

1516
@end
1617

KtTableView/KtTableView/KTMainViewController.m

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
#import "KtMainTableViewCell.h"
1111
#import "KtMainTableViewDataSource.h"
1212

13-
@interface KTMainViewController () <UITableViewDelegate>
13+
@interface KTMainViewController () <KtTableViewDelegate>
1414

15-
@property (strong, nonatomic) NSMutableArray *items;
1615
@property (strong, nonatomic) KtMainTableViewDataSource *dataSource;
1716

1817
@end
@@ -22,15 +21,13 @@ @implementation KTMainViewController
2221
- (void)viewDidLoad {
2322
[super viewDidLoad];
2423

25-
self.items = [NSMutableArray arrayWithObjects:@"第一条消息", @"第二条消息", @"第三条消息", @"第四条消息", @"第五条消息", nil];
26-
27-
self.tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
24+
self.tableView = [[KtBaseTableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
2825
[self.view addSubview:self.tableView];
2926

30-
self.tableView.delegate = self;
27+
self.tableView.ktDelegate = self;
3128

3229
self.dataSource = [[KtMainTableViewDataSource alloc] init]; // 这一步创建了数据源
33-
self.tableView.dataSource = self.dataSource; // 绑定了数据源
30+
self.tableView.ktDataSource = self.dataSource; // 绑定了数据源
3431
self.tableView.tableFooterView = [[UIView alloc] init]; // 去掉多余分割线
3532

3633
// Do any additional setup after loading the view, typically from a nib.

0 commit comments

Comments
 (0)