iOS表格控件:TSTableView
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). </ul>

下面提供示例的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]; 
                     本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
                         轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
                         本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!