forked from bestswifter/MySampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKTMainViewController.m
More file actions
43 lines (34 loc) · 1 KB
/
KTMainViewController.m
File metadata and controls
43 lines (34 loc) · 1 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
//
// ViewController.m
// KtTableView
//
// Created by bestswifter on 16/4/13.
// Copyright © 2016年 zxy. All rights reserved.
//
#import "KTMainViewController.h"
#import "KtMainTableViewCell.h"
#import "KtMainTableViewDataSource.h"
#import "AFNetworking.h"
#import "KtTableViewBaseItem.h"
#import "KtMainTableModel.h"
#import "MJRefresh.h"
@implementation KTMainViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self createModel];
}
- (void)createModel {
self.listModel = [[KtMainTableModel alloc] initWithAddress:@"/mooclist.php"];
self.listModel.delegate = self;
}
- (void)createDataSource {
self.dataSource = [[KtMainTableViewDataSource alloc] init]; // 这一步创建了数据源
}
- (void)requestDidSuccess {
for (KtMainTableBookItem *book in ((KtMainTableModel *)self.listModel).tableViewItem.books) {
KtTableViewBaseItem *item = [[KtTableViewBaseItem alloc] init];
item.itemTitle = book.bookTitle;
[self.dataSource appendItem:item];
}
}
@end