File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77//
88
99#import " AppDelegate.h"
10+ #import " KTMainViewController.h"
1011
1112@interface AppDelegate ()
1213
@@ -17,6 +18,8 @@ @implementation AppDelegate
1718
1819- (BOOL )application : (UIApplication *)application didFinishLaunchingWithOptions : (NSDictionary *)launchOptions {
1920 // Override point for customization after application launch.
21+ KTMainViewController *mainVC = [[KTMainViewController alloc ] initWithStyle: UITableViewStylePlain];
22+ [self .window setRootViewController: mainVC];
2023 return YES ;
2124}
2225
Original file line number Diff line number Diff line change 77//
88
99#import < UIKit/UIKit.h>
10- #import " KtBaseTableView .h"
10+ #import " KtTableViewController .h"
1111
12- @interface KTMainViewController : UIViewController
13-
14- @property (nonatomic , strong ) KtBaseTableView *tableView;
12+ @interface KTMainViewController : KtTableViewController
1513
1614@end
1715
Original file line number Diff line number Diff line change 1010#import " KtMainTableViewCell.h"
1111#import " KtMainTableViewDataSource.h"
1212
13- @interface KTMainViewController () <KtTableViewDelegate>
13+ @interface KTMainViewController ()
1414
15- @property (strong , nonatomic ) KtMainTableViewDataSource *dataSource;
1615
1716@end
1817
1918@implementation KTMainViewController
2019
2120- (void )viewDidLoad {
2221 [super viewDidLoad ];
23-
24- self.tableView = [[KtBaseTableView alloc ] initWithFrame: self .view.frame style: UITableViewStylePlain];
25- [self .view addSubview: self .tableView];
26-
27- self.tableView .ktDelegate = self;
28-
29- self.dataSource = [[KtMainTableViewDataSource alloc ] init ]; // 这一步创建了数据源
30- self.tableView .ktDataSource = self.dataSource ; // 绑定了数据源
31- self.tableView .tableFooterView = [[UIView alloc ] init ]; // 去掉多余分割线
32-
3322 // Do any additional setup after loading the view, typically from a nib.
3423}
3524
25+ - (void )createDataSource {
26+ self.dataSource = [[KtMainTableViewDataSource alloc ] init ]; // 这一步创建了数据源
27+ }
28+
3629- (void )didReceiveMemoryWarning {
3730 [super didReceiveMemoryWarning ];
3831 // Dispose of any resources that can be recreated.
You can’t perform that action at this time.
0 commit comments