All Projects → josercc → ZHTableViewGroup

josercc / ZHTableViewGroup

Licence: MIT license
Manger UITableView DataSource Cells

Programming Languages

objective c
16641 projects - #2 most used programming language
swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to ZHTableViewGroup

PluginTableViewController
Example project for article: Data-Driven Table Views. See blog post for more details: http://www.vadimbulavin.com/data-drive-table-views/
Stars: ✭ 18 (-5.26%)
Mutual labels:  uitableview, uitableviewdatasource
TreeView
"TreeView - sub-cells simplified" (c). Enable subcells in UITableView with a single drop-in extension. CocoaPod:
Stars: ✭ 54 (+184.21%)
Mutual labels:  uitableview, uitableviewdatasource
Expandabletable
AZExpandable is a lightweight proxy for UITableView to expand cells.
Stars: ✭ 218 (+1047.37%)
Mutual labels:  uitableview
DropDownTableView
Here is a drop-down TableView.
Stars: ✭ 16 (-15.79%)
Mutual labels:  uitableview
Cyanic
Declarative, state-driven UI framework
Stars: ✭ 32 (+68.42%)
Mutual labels:  uitableview
Magearrefreshcontrol
An iOS refresh control with gear animation
Stars: ✭ 231 (+1115.79%)
Mutual labels:  uitableview
Automatic Height Tagcells
This is a sample project to implement features with dynamic height of UITableViewCell based on autolayout, tags aligned automatically and clickable tags.
Stars: ✭ 229 (+1105.26%)
Mutual labels:  uitableview
Swiftycomments
UITableView based component designed to display a hierarchy of expandable/foldable comments.
Stars: ✭ 200 (+952.63%)
Mutual labels:  uitableview
StackableTableView
A UITableView subclass that enables setting an array of views for both headers and footers utilizing UIStackView
Stars: ✭ 72 (+278.95%)
Mutual labels:  uitableview
DraggableModalTransition
Enables dragging interaction and animation of scrollView in a similar way to Facebook Messenger app.
Stars: ✭ 63 (+231.58%)
Mutual labels:  uitableview
PagedLists
Paginated UITableView and UICollectionViews for iOS.
Stars: ✭ 69 (+263.16%)
Mutual labels:  uitableview
IQListKit
Model driven UITableView/UICollectionView
Stars: ✭ 51 (+168.42%)
Mutual labels:  uitableview
Tabanimated
A skeleton screen framework based on native for iOS. (一个由iOS原生组件映射出骨架屏的框架,包含快速植入,低耦合,兼容复杂视图等特点,提供国内主流骨架屏动画的加载方案,同时支持上拉加载更多、自定制动画。)
Stars: ✭ 2,909 (+15210.53%)
Mutual labels:  uitableview
HDEmptyView
一个Swift语言封装的EmptyView显示库,可作用于WKWebView、UITableView、UICollectionView 无网络提醒或者空数据提醒
Stars: ✭ 29 (+52.63%)
Mutual labels:  uitableview
Mentions
An easy way to add mentions and hashtags
Stars: ✭ 24 (+26.32%)
Mutual labels:  uitableview
Flowkit
A declarative type-safe framework for building fast and flexible list with Tables & Collection
Stars: ✭ 215 (+1031.58%)
Mutual labels:  uitableview
react-native-js-tableview
A JavaScript implementation for TableView that looks great on both iOS and Android.
Stars: ✭ 23 (+21.05%)
Mutual labels:  uitableview
AUPickerCell
Embedded picker view for table cells.
Stars: ✭ 19 (+0%)
Mutual labels:  uitableview
AdoHideTableSection
An easy way to hide or show section in a tableview
Stars: ✭ 57 (+200%)
Mutual labels:  uitableview
VPAutoComplete
A simple Auto Complete UITextField also support UITableView written in swift 4.2
Stars: ✭ 20 (+5.26%)
Mutual labels:  uitableview

filename:images

Swift 版本请移步这里

ZHTableViewGroupUITableViewUICollectionView 而生

演示

简单的列表

image-20200928175235608

ZHTableViewDataSource *dataSource = [[ZHTableViewDataSource alloc] initWithTableView:self.tableView];
[dataSource clearData];
[dataSource addGroupWithCompletionHandle:^(ZHTableViewGroup * _Nonnull group) {
    [group addCellWithCompletionHandle:^(ZHTableViewCell *tableViewCell) {
        tableViewCell.anyClass = [UITableViewCell  class];
        tableViewCell.identifier = @"UITableViewCell";
        NSArray<NSString *> *titles = @[@"刷新高度",@"刷新Cell",@"刷新数据",@"显示和隐藏"];
        tableViewCell.cellNumber = titles.count;
        [tableViewCell setConfigCompletionHandle:^(UITableViewCell *cell, NSIndexPath *indexPath) {
            cell.textLabel.text = titles[indexPath.row];
        }];
    }];
}];
[dataSource reloadTableViewData];

动态刷新高度

image-20200928175932428

[self.tableViewDataSource clearData];
[self.tableViewDataSource addGroupWithCompletionHandle:^(ZHTableViewGroup *group) {
    [group addCellWithCompletionHandle:^(ZHTableViewCell<ReloadHeightCell1 *> *cell) {
        self->_weakCell = cell;
        cell.anyClass = [ReloadHeightCell1 class];
        cell.identifier = @"ReloadHeightCell1";
        [cell setConfigCompletionHandle:^(ReloadHeightCell1 *cell1, NSIndexPath *indexPath) {
            cell1.textLabel.text = @"ReloadHeightCell1";
        }];
    }];
}];
[self.tableViewDataSource addGroupWithCompletionHandle:^(ZHTableViewGroup *group) {
    [group addCellWithCompletionHandle:^(ZHTableViewCell<ReloadHeightCell2 *> *cell) {
        cell.anyClass = [ReloadHeightCell2 class];
        cell.identifier = @"ReloadHeightCell2";
        cell.cellNumber = 2;
        [cell setConfigCompletionHandle:^(ReloadHeightCell2 *cell1, NSIndexPath *indexPath) {
            cell1.textLabel.text = @"ReloadHeightCell2";
        }];
    }];
}];
[self.tableViewDataSource reloadTableViewData];

identifier更新自动高度

[self.tableViewDataSource reloadCellAutomaticHeightWithIdentifier:@"ReloadHeightCell1"]

identifier更新固定250高度

[self.tableViewDataSource reloadCellFixedHeight:250 identifier:@"ReloadHeightCell1"]

Class更新自动高度

[self.tableViewDataSource reloadCellAutomaticHeightWithClass:NSClassFromString(@"ReloadHeightCell1")]

Class更新固定260高度

[self.tableViewDataSource reloadCellFixedHeight:260 className:NSClassFromString(@"ReloadHeightCell1")]

指定ZHTableViewCell更新自动高度

[self.tableViewDataSource reloadCellAutomaticHeightWithTableViewCell:self.tableViewDataSource.groups[0].cells[0]]

指定ZHTableViewCell更新固定270高度

[self.tableViewDataSource reloadCellFixedHeight:270 tableViewCell:self.tableViewDataSource.groups[0].cells[0]]

指定索引更新自动高度

[self.tableViewDataSource reloadCellAutomicHeightWithGroupIndex:1 cellIndex:0]

指定索引更新固定280高度

[self.tableViewDataSource reloadCellFixedHeight:280 groupIndex:1 cellIndex:0]

刷新值

image-20200928180955425

[self.tableViewDataSource clearData];
[self.tableViewDataSource addGroupWithCompletionHandle:^(ZHTableViewGroup *group) {
    [group addCellWithCompletionHandle:^(ZHTableViewCell *cell) {
        cell.anyClass = [UITableViewCell class];
        cell.identifier = @"UITableViewCell";
        [cell setConfigCompletionHandle:^(UITableViewCell *cell, NSIndexPath *indexPath) {
            cell.textLabel.text = [@(random() % 99 + 1) stringValue];
        }];
    }];
}];
[self.tableViewDataSource reloadTableViewData];

通过Identifier刷新

[self.tableViewDataSource reloadCellWithIdentifier:@"UITableViewCell"]

通过Class刷新

[self.tableViewDataSource reloadCellWithClassName:[UITableViewCell class]]

通过指定UITableViewCell更新

[self.tableViewDataSource reloadCellWithTableViewCell:self.tableViewDataSource.groups[0].cells[0]]

通过索引更新

[self.tableViewDataSource reloadCellWithGroupIndex:0 cellIndex:0]

刷新个数

image-20200928181349639

_randoms = [NSMutableArray arrayWithArray:@[@"random"]];
[self.tableViewDataSource clearData];
[self.tableViewDataSource addGroupWithCompletionHandle:^(ZHTableViewGroup *group) {
    [group addCellWithCompletionHandle:^(ZHTableViewCell *cell) {
        cell.anyClass = [UITableViewCell class];
        cell.identifier = @"UITableViewCell";
        cell.cellNumber = _randoms.count;
        [cell setConfigCompletionHandle:^(UITableViewCell *cell, NSIndexPath *indexPath) {
            cell.textLabel.text = _randoms[indexPath.row];
        }];
    }];
}];
[self.tableViewDataSource reloadTableViewData];

identifier刷新个数

[self.tableViewDataSource reloadCellWithDataCount:_randoms.count identifier:@"UITableViewCell"]

Class刷新个数

[self.tableViewDataSource reloadCellWithDataCount:_randoms.count className:[UITableViewCell class]]

UITableViewCell刷新个数

[self.tableViewDataSource reloadCellWithDataCount:_randoms.count tableViewCell:self.tableViewDataSource.groups[0].cells[0]]

索引刷新个数

[self.tableViewDataSource reloadCellWithDataCount:_randoms.count groupIndex:0 cellIndex:0]

显示和隐藏

image-20200928190127141

[self.tableViewDataSource clearData];
[self.tableViewDataSource addGroupWithCompletionHandle:^(ZHTableViewGroup *group) {
    [group addCellWithCompletionHandle:^(ZHTableViewCell *cell) {
        cell.anyClass = [UITableViewCell class];
        cell.identifier = @"UITableViewCell";
        cell.cellNumber = 10;
        [cell setConfigCompletionHandle:^(UITableViewCell *cell, NSIndexPath *indexPath) {
            cell.textLabel.text = [@(indexPath.row + 1) stringValue];
        }];
        [cell setHiddenBlock:^BOOL(NSIndexPath *indexPath) {
            return _hidden && indexPath.row >= 5 && indexPath.row <= 8;
        }];
    }];
}];
[self.tableViewDataSource reloadTableViewData];

隐藏Cell

[self.tableViewDataSource reloadAllHiddenCell]

怎么安装

Cocoapods

pod 'ZHTableViewGroup'

Carthage

github "josercc/ZHTableViewGroup"

Swift Package Manager

.package(url: "https://github.com/josercc/ZHTableViewGroup.git", from: "3.0.0")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].