WYLCoreDataTableView 1.0.8

WYLCoreDataTableView 1.0.8

测试测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布Nov 2018

wangyanlong维护。



  • 王颜龙

WYLCoreDataTableView

一个基于NSFetchedResultController的TableView

入门

使用 CocoaPods

1. 将 pod WYLCoreDataTableView 添加到您的 Podfile

pod 'WYLCoreDataTableView'

2. 在终端中运行 pod install,然后打开您的应用 .xcworkspace 文件以启动 Xcode。

3. 在您想使用 API 的地方添加 #import WYLCoreDataTableView.h

从 GitHub 手动安装

1. 下载 源目录 中的 WYLCoreDataTableView.hWYLCoreDataTableView.m 文件

2. 将两个文件添加到您的 Xcode 项目中。

3. 在您想使用 API 的地方添加 #import WYLCoreDataTableView.h

### 示例用法

示例位置

查看包含在存储库中的 示例项目。其中包含用于各种场景的 API 的几个示例。

用法

1. 程序需要包含 Core Data 相关文件。

2. 创建一个实体。

3. 创建一个继承自 WYLCoreDataTableView 的列表。

4. 按如下方式配置新的 tableView

objc

AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;

CollectionTableView *ctv = [[CollectionTableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"comicID" ascending:YES];
ctv.context = app.managedObjectContext;
ctv.sortArray = @[sortDescriptor];
ctv.entityName = @"Comic";
[ctv createFetchTableViewInfomation];
[ctv registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];


[self.view addSubview:ctv];

5. 按如下方式自定义新的 tableView 的代理方法

#import "Comic.h"
#import "CollectionTableView.h"

@implementation CollectionTableView

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];

Comic *c = [self.frc objectAtIndexPath:indexPath];
cell.textLabel.text = c.name;

return cell;

}

版本 1.0.6

修复 iOS8 bug,改为使用 cell registerClass。

版本 1.0.4

无数据时连接至用户以显示无数据页面 #许可证 MIT