iOS表格控件:TSTableView

jopen 12年前

TSTableView是UI组件,用于显示多列的表格数据支持分层行和列的结构。它为项目的选择和动态内容修改提供了流畅的动画。下面列出了一些功能:

  • Suport muti columns data structure.
  • Support hierarchical column definition (i.e. column may have subsections).
  • Support hierarchical row definition (i.e. row may have expand subrows).
  • Optimized to display big sets of data: row and cell views are cached internally and reused during scrolling.
  • Support row and column selection.
  • Allow modification of column width by sliding column border.
  • Allow expand/collapse subrows content.
  • Support simple declarative syntax for columns and rows content definition.
  • Providing your own implementation of TSTableViewDataSource protocol will allow you fully customise structure and appearance of the table.
  • Default TSTableViewModel implements TSTableViewDataSource protocol and includes two built in styles (see screenshots).

iOS表格控件:TSTableView

 

下面提供示例的TSTableView对象实例化。

    NSArray *columns = @[                           @{ @"title" : @"Column 1", @"subtitle" : @"This is first column"},                           @{ @"title" : @"Column 2", @"subcolumns" : @[                                      @{ @"title" : @"Column 2.1", @"headerHeight" : @20},                                      @{ @"title" : @"Column 2.2", @"headerHeight" : @20}]},                           @{ @"title" : @"Column 3", @"titleColor" : @"FF00CF00"}                           ];        NSArray *rows = @[                        @{ @"cells" : @[                                   @{ @"value" : @"Value 1"},                                   @{ @"value" : @1},                                   @{ @"value" : @2},                                   @{ @"value" : @3}                                   ]                           },                        @{ @"cells" : @[                                   @{ @"value" : @"Value 2"},                                   @{ @"value" : @2},                                   @{ @"value" : @3},                                   @{ @"value" : @4}                                   ]                           }                        ];        TSTableView *tableView = [[TSTableView alloc] initWithFrame:self.view.bounds];      tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;      tableView.delegate = self;      [self.view addSubview:tableView];        TSTableViewModel  *dataModel = [[TSTableViewModel alloc] initWithTableView:tableView andStyle:kTSTableViewStyleDark];      [dataModel setColumns:columns andRows:rows];

项目主页:http://www.open-open.com/lib/view/home/1379212684756