TableViewAutolayoutManager 0.2

TableViewAutolayoutManager 0.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2016
SPMSupports SPM

Maintained by Artur Jaworski.



  • By
  • Artur Jaworski

Description

Automatically takes care of custom UITableViewCell dynamic height. Written in Swift.

Installation

TableViewAutolayoutManager is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TableViewAutolayoutManager"

Quick Start

Before you use it

TableViewAutolayoutManager inherits from TableViewManager. Please see TableViewManager first.

Please be sure that you have to use this pod. In most cases self sizing cells is enough.

TableViewAutolayoutManager using UIView systemLayoutSizeFittingSize(_:) to calculate height.

Step 1

Do all steps described in TableViewManager, but do it with TableViewAutolayoutManager instead of TableViewManager and TableViewAutolayoutManagerProtocol instead of TableViewManagerProtocol.

import TableViewAutolayoutManager
extension ViewController: TableViewAutolayoutManagerProtocol {
    // (...)
}

Step 2

Implemment tableView(_:heightForRowAtIndexPath:) as below.

extension ViewController: UITableViewDataSource, UITableViewDelegate {
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return self.tableViewAutolayoutManager(tableView, heightForRowAtIndexPath: indexPath)
    }

    // (...)
}

That's all!

License

TableViewAutolayoutManager is available under the MIT license. See the LICENSE file for more info.