You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
954 B
39 lines
954 B
//
|
|
// CellHeightManager.swift
|
|
// elpha-ios
|
|
//
|
|
// Created by Dwayne Harris on 11/10/18.
|
|
// Copyright © 2018 Elpha. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class CellHeightManager {
|
|
static private var cellHeightsDictionary: NSMutableDictionary = [:]
|
|
|
|
static func set(statusID: String, height: CGFloat) {
|
|
cellHeightsDictionary[statusID] = height
|
|
}
|
|
|
|
static func set(status: StatusMO?, height: CGFloat) {
|
|
if let id = status?.id {
|
|
set(statusID: id, height: height)
|
|
}
|
|
}
|
|
|
|
static func get(statusID: String) -> CGFloat {
|
|
if let height = cellHeightsDictionary[statusID] as? CGFloat {
|
|
return height
|
|
}
|
|
|
|
return UITableView.automaticDimension
|
|
}
|
|
|
|
static func get(status: StatusMO?) -> CGFloat {
|
|
if let id = status?.id {
|
|
return get(statusID: id)
|
|
}
|
|
|
|
return UITableView.automaticDimension
|
|
}
|
|
}
|