初始化
- (void)initWithTableView {
self.myTableView.dataSource = self;
self.myTableView.delegate = self;
[self.myTableView registerNib:[UINib nibWithNibName:[QHPiLittleDrawListTableViewCell identifier] bundle:nil] forCellReuseIdentifier:[QHPiLittleDrawListTableViewCell identifier]];
self.myTableView.tableFooterView = [UIView new];
self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
实现协议
#pragma mark UITableViewDelegate, UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 80;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
QHPiLittleDrawListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[QHPiLittleDrawListTableViewCell identifier]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}