-
Notifications
You must be signed in to change notification settings - Fork 0
coderPoo/SplitTableView
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Latest commit | ||||
Repository files navigation
```
//注册cell 这个位置可以再封装一层
[self.tableView registerNib:[UINib nibWithNibName:@"TableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
self.splitDS = [[XBSplitDataSource alloc] initWithItems:@[@"瘦身",@"再瘦身"] cellIdentifier:@"cell" configCellBlock:cellBlock];
//设置数据源 为 splitDS
self.tableView.dataSource = self.splitDS;
```
```
@implementation XBSplitDataSource
#pragma mark - UITableViewDataSource
//
-(instancetype)init{
return nil;
}
//初始化方法
- (id)initWithItems:(NSArray *)items
cellIdentifier:(NSString *)cellIdentifier
configCellBlock:(TableViewCellConfigureBlock)configCellBlock{
self = [super init];
if (self) {
self.items = items;
self.cellIdentifier = cellIdentifier;
self.configCellBlock = [configCellBlock copy];
}
return self;
}
#pragma mark - uitableview dataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.items.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier forIndexPath:indexPath];
id item = [self itemIndexPath:indexPath];
self.configCellBlock(cell, item);
return cell;
}
- (id)itemIndexPath:(NSIndexPath *)indexPath{
return self.items[indexPath.row];
}
@end
```
git init 查看xcode生产项目的.git地址
rm -rf .git 移除.git
ls -a 查看是否还存在文件.git
再导入仓库 git就可以检测到文件变化
About
tableView 拆分数据源
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published