SettingsTableViewCell.swift 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // SettingsTableViewCell.swift
  3. // Loop
  4. //
  5. // Copyright © 2018 LoopKit Authors. All rights reserved.
  6. //
  7. import UIKit
  8. public class SettingsTableViewCell: UITableViewCell {
  9. public static let EnabledString = LocalizedString("Enabled", comment: "The detail text describing an enabled setting")
  10. public static let NoValueString = LocalizedString("–", comment: "The detail text representing no value")
  11. public static let TapToSetString = LocalizedString("Tap to set", comment: "The empty-state text for a configuration value")
  12. public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  13. super.init(style: .value1, reuseIdentifier: reuseIdentifier)
  14. setup()
  15. }
  16. required public init?(coder aDecoder: NSCoder) {
  17. super.init(coder: aDecoder)
  18. setup()
  19. }
  20. private func setup() {
  21. textLabel?.adjustsFontForContentSizeCategory = true
  22. textLabel?.font = UIFont.preferredFont(forTextStyle: .body)
  23. detailTextLabel?.adjustsFontForContentSizeCategory = true
  24. detailTextLabel?.font = UIFont.preferredFont(forTextStyle: .body)
  25. }
  26. override public func prepareForReuse() {
  27. super.prepareForReuse()
  28. accessoryType = .none
  29. textLabel?.text = nil
  30. detailTextLabel?.text = nil
  31. accessoryView = nil
  32. isUserInteractionEnabled = true
  33. }
  34. }