Latest 0.1.8
Homepage https://github.com/JavenZ/ZJTableViewManager
License MIT
Platforms ios 8.0
Authors

ZJTableViewManager

Platform
Language
License

Powerful data driven content manager for UITableView.
ZJTableViewManager is a lightweight, pure-Swift library for manage the content of any UITableView with ease, both forms and lists. This project is heavily inspired by the popular RETableViewManager.

ZJTableViewManager is built on top of reusable cells technique and provides APIs for mapping any object class to any custom cell subclass.

The general idea is to allow developers to use their own UITableView and UITableViewController instances (and even subclasses), providing a layer that synchronizes data with the cell appearance.
It fully implements UITableViewDelegate and UITableViewDataSource protocols so you don’t have to.

Installation

cocoapods
pod 'ZJTableViewManager'

Quick Example

image

Get your UITableView up and running in several lines of code:

        self.manager = ZJTableViewManager(tableView: self.tableView)

        //add section
        let section = ZJTableViewSection()
        self.manager.add(section: section)

        //Simple String
        section.add(item: ZJTableViewItem(title: "Simple String"))

        //Full length text field
        section.add(item: ZJTextFieldItem(title: nil, placeHolder: "Full length text field", text: nil, isFullLength: true, didChanged: nil))

        //Text Item
        section.add(item: ZJTextFieldItem(title: "Text Item", placeHolder: "Text", text: nil,  didChanged: nil))

        //Password
        let passwordItem = ZJTextFieldItem(title: "Password", placeHolder: "Password Item", text: nil,  didChanged: nil))
        passwordItem.isSecureTextEntry = true
        section.add(item: passwordItem)

        //Switch Item
        section.add(item: ZJSwitchItem(title: "Switch Item", isOn: false,  didChanged: nil))

Other

delete cell with animation:

passwordItem.delete(.automatic)

swipe delete cell:

item.editingStyle = .delete
item.setDeletionHandler(deletionHandler: {[weak self] (item) in
      self?.deleteConfirm(item: item)
      })

reload cell:

passwordItem.reload(.automatic)

update cell height:

item.cellHeight = 200
item.updateHeight()

reload section:

section.reload(.automatic)

sectionHeader call back

section.setHeaderWillDisplayHandler({ (currentSection) in
                print("Section" + String(currentSection.index) + " will display!")
            })

section.setHeaderDidEndDisplayHandler({ (currentSection) in
                print("Section" + String(currentSection.index) + " did end display!")
            })

Other Demo

image image

** This is the entire code for this comment page viewController.

override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "Demo"
        self.manager = ZJTableViewManager(tableView: self.tableView)

        //register cell
        self.manager?.register(OrderEvaluateCell.self, OrderEvaluateItem.self)
        self.manager?.register(ZJPictureTableCell.self, ZJPictureTableItem.self)

        //add section
        let section = ZJTableViewSection(headerHeight: 10, color: UIColor.init(white: 0.9, alpha: 1))
        self.manager?.add(section: section)

        //add cells
        for i in 0...10 {
            //evaluat cell
            section.add(item: OrderEvaluateItem(title: "评价"))
            let textItem = ZJTextItem(text: nil, placeHolder: "请在此输入您的评价~", didChanged: nil)
            textItem.isHideSeparator = true
            section.add(item: textItem)

            //picture cell
            if i%2 == 1 {
                //pictures readonly
                let pictureItem = ZJPictureTableItem(maxNumber: 5, column: 4, space: 15, width: self.view.frame.size.width, superVC: self, pictures: [image])
                pictureItem.type = .read
                section.add(item: pictureItem)
            }else{
                //pictures editable
                let pictureItem = ZJPictureTableItem(maxNumber: 5, column: 4, space: 15, width: self.view.frame.size.width, superVC: self)
                pictureItem.type = .edit
                section.add(item: pictureItem)
            }
        }
    }

Latest podspec

{
    "name": "ZJTableViewManager",
    "version": "0.1.8",
    "summary": "Powerful data driven content manager for UITableView. RETableViewManageru7684Swiftu7248 RETableViewManager's Swift Version",
    "description": "ZJTableViewManager allows to manage the content of any UITableView with ease, both forms and lists. ZJTableViewManager is built on top of reusable cells technique and provides APIs for mapping any object class to any custom cell subclass.",
    "homepage": "https://github.com/JavenZ/ZJTableViewManager",
    "license": {
        "type": "MIT",
        "file": "FILE_LICENSE"
    },
    "authors": {
        "Javen": "[email protected]"
    },
    "source": {
        "git": "https://github.com/JavenZ/ZJTableViewManager.git",
        "tag": "0.1.8"
    },
    "source_files": [
        "ZJTableViewManager",
        "ZJTableViewManager/**/*"
    ],
    "platforms": {
        "ios": "8.0"
    }
}

Pin It on Pinterest

Share This