Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

coderPoo/SplitTableView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

10 Commits

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

No packages published

AltStyle によって変換されたページ (->オリジナル) /