测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最新发布 | 2014年12月 |
由 Peter Stuart 维护。
EPSStaticTableViewController
是 UITableViewController
的子类,它使设置静态内容的表格视图变得简单。
要使用 EPSStaticTableViewController
,继承它并覆盖以下方法
- (NSArray *)identifiers
在此方法中,返回一个包含 NSString
对象的数组数组。每个内部数组代表表格视图的一个部分。例如,返回
@[ @[ @"One", @"Two" ], @[ @"A" ], @[ @"X", @"Y", @"Z" ] ]
将生成一个包含三个部分、分别包含两行、一行和三行的表格视图。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowWithIdentifier:(NSString *)identifier indexPath:(NSIndexPath *)indexPath
此方法替换了 UITableViewDelegate
方法 tableView:cellForRowAtIndexPath:
,这样您就可以使用 identifier
来决定如何设置单元格,而不是使用 indexPath
。
- (void)tableView:(UITableView *)tableView didSelectRowWithIdentifier:(NSString *)identifier indexPath:(NSIndexPath *)indexPath
此方法替换了 UITableViewDelegate
方法 tableView:didSelectRowAtIndexPath:
,这样您就可以使用 identifier
来决定要采取什么操作,而不是使用 indexPath
。
EPSStaticTableVIewController 通过 CocoaPods 提供,要安装它,只需将以下行添加到 Podfile 中
pod "EPSStaticTableViewController"
或者,将 EPSStaticTableViewController.h
和 EPSStaticTableViewController.m
包含到您的项目中。
EPSStaticTableViewController 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。