From 018c35ef5317614b8e00ff260fd4b2102ce40100 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Thu, 16 Jun 2016 01:16:53 +0300 Subject: [PATCH] update readme --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 1055f80..2933cde 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ It nice to have some actions that related to your cells: let action = TableRowAction(.click) { (data) in // you could access any useful information that relates to the action + // data.cell - StringTableViewCell? // data.item - String // data.path - NSIndexPath @@ -90,6 +91,7 @@ row return false }) ``` +You could find all available actions here. #### Batch rows You could have a situation when you need a lot of cells with the same type. In that case it's better to use `TableRowBuilder`: @@ -110,6 +112,37 @@ let builder = TableRowBuilder(items: ["1", "2", "3" section.append(builder: builder) ``` +#### Cell height calculating strategy +By default TableKit relies on self-sizing cells. In that case you have to provide an estimated height for your cells: +```swift +class StringTableViewCell: UITableViewCell, ConfigurableCell { + + // ... + + static func estimatedHeight() -> CGFloat { + return 44 + } +} +``` +It's enough for most cases. But you may not be happy with this. So you could use +```swift +tableDirector.shouldUsePrototypeCellHeightCalculation = true +``` +It does all dirty work with prototypes behind the scene, so you don't have to worry about anything except of your cell configuration: +```swift +class ImageTableViewCell: UITableViewCell, ConfigurableCell { + + func configure(url: NSURL, isPrototype: Bool) { + + if !isPrototype { + loadImageAsync(url: url, imageView: imageView) + } + } +} +``` +As you can see you don't have to load any remote images to your cell, cause it's not visible. It's a prototype cell, just to calculate apropriate height. + + ## Installation #### CocoaPods