ZWCommonTable 1.0.4

ZWCommonTable 1.0.4

测试测试过的
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2018年7月

wang_ziwu维护。



  • 作者:
  • wangziwu

ZWCommonTableDemo

Version License Platform Language

简介

  • 构建 CommontableController 的简单方法。

详细介绍请参考我的简书

http://www.jianshu.com/p/bb172ecf68fe

框架整体介绍

  • 该框架是一个通用 Table 页面展示框架,旨在提供一种简单 Table 页面编写的模板。
  • 1.支持普通 tableView 界面。
  • 2.支持对 tableView 中的 cell 进行自定义。
  • 4.框架支持默认点击 cell,推送到自定义的 Controller 中。也可拦截 p 点击事件,执行自定义方法中。

框架使用方法

  • 直接将 ZWCommonTable 文件夹拖入到您的工程中。

    #import "ZWCommonTable.h"
  • Cocoapods 安装

    pod search ZWCommonTable
    pod 'ZWCommonTable',		'~> 1.0.0'
    #import <ZWCommonTable/ZWCommonTable.h>

    如果发现pod search ZWCommonTable,然后执行pod repo update --verbose命令更新本地spec缓存(可能需要几分钟),然后再搜索就可以了。

代码解析

配置UITableView的协议转发。

-(void)setupTableView{
    __weak typeof(self) weakSelf = self;
    _comDelegate = [[ZWCommonTableDelegate alloc] initWithTableData:^NSArray *{
        return weakSelf.dataSourceArr;
    }];
    self.mTable.tableFooterView = [UIView new];
    self.mTable.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.mTable.frame.size.width, CGFLOAT_MIN)];
    self.mTable.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.mTable.delegate = _comDelegate;
    self.mTable.dataSource = _comDelegate;
    [self.view addSubview:self.mTable];
}
-(void)setData{
    self.dataSourceArr = @[
                           @{
                               SectionHeaderTitle    :@"",
                               SectionHeaderHeight   :@"",
                               SectionFooterTitle    :@"",
                               SectionFooterHeight   :@"",
                               SectionRows           :@[
                                       @{
                                           CellTitle           :@"微信-事例一",
                                           CellPushVcClassName :@"WeChatMineCtr"
                                           },
                                       @{
                                           CellTitle           :@"微信_事例二",
                                           CellPushVcClassName :@"WeChatSettingCtr"
                                           },
                                       @{
                                           CellTitle           :@"通用",
                                           CellImageName       :@"icon_profile_depart",
                                           CellPushVcClassName :@"CommonTableCtr"
                                           }
                                       ]
                               },
                           ];
    self.dataSourceArr = [ZWCommonTableSection sectionsWithData:self.dataSourceArr];
}