测试已测试 | ✓ |
Lang语言 | Obj-CObjective C |
许可 | MIT |
发布最后发布 | 2016年10月 |
由 Jérôme Morissard 维护。
JMOTableViewDescription 是一个 Objective-C 库,可以轻松创建和管理复杂的 structured tableView。
为什么这个项目?
本项目提供
注意:'支持的' 意味着库已与本版本进行测试。'兼容的' 意味着库应该在该 iOS 版本上运行(即它不依赖任何不可用的 SDK 功能),但不再进行兼容性测试,可能需要调整或修复 bug 以正确运行。
JMODemoTableViewDescription *desc = [JMODemoTableViewDescription new];
JMOTableViewSectionDescription *oneSection = [JMOTableViewSectionDescription new];
JMOTableViewRowDescription *oneRow = [JMOTableViewRowDescription new];
oneRow.cellClass = [UITableViewCell class];
oneRow.cellHeight = 30.0f;
oneRow.cellReuseIdentifier = @"UITableViewCellIdentifier";
oneRow.data = @"My Fake 1st section (it's a cell!)";
[oneSection addRowDescription:oneRow];
...
return desc;
@protocol JMOTableViewDescriptionCellUpdate <NSObject>
@optional
- (void)updateCellWithData:(id)data;
- (void)updateCellWithRowDescription:(id)data;
@end
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
//You can manage your own custom update
if (cell.class == UITableViewCell.class) {
JMOTableViewRowDescription *rowDesc = [self.tableViewDescription rowDescriptionForIndexPath:indexPath];
cell.textLabel.text = rowDesc.data;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectDataDescription:(id)selectedData
{
JMOLog(@"Do something with selectedData : %@",selectedData);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"TableViewDescriptionDelegate" message:@"Do something with selected Data" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alert show];
}