Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Fixes #1592: Settings cells inconsistent
Browse files Browse the repository at this point in the history
  • Loading branch information
sblatz committed Nov 26, 2018
1 parent 7307134 commit b99bc86
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Blockzilla/SettingsViewController.swift
Expand Up @@ -115,13 +115,24 @@ class SettingsTableViewToggleCell: SettingsTableViewCell {

newLabel.numberOfLines = 0
newLabel.text = toggle.label

setupDynamicFont()

if #available(iOS 10.0, *) {
newLabel.adjustsFontForContentSizeCategory = true
newDetailLabel.adjustsFontForContentSizeCategory = true
} else {
NotificationCenter.default.addObserver(forName: UIContentSizeCategory.didChangeNotification, object: nil, queue: nil) { _ in
self.setupDynamicFont()
}
}

textLabel?.numberOfLines = 0
textLabel?.text = toggle.label

newDetailLabel.numberOfLines = 0
newDetailLabel.text = toggle.subtitle
detailTextLabel?.numberOfLines = 0
detailTextLabel?.text = nil
detailTextLabel?.text = toggle.subtitle

backgroundColor = UIConstants.colors.cellBackground
newLabel.textColor = UIConstants.colors.settingsTextLabel
Expand Down Expand Up @@ -185,6 +196,11 @@ class SettingsTableViewToggleCell: SettingsTableViewCell {
}
}

private func setupDynamicFont() {
newLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
newDetailLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
}

private func tappedFooter(topic: String) {
guard let url = SupportUtils.URLForTopic(topic: topic) else { return }
let contentViewController = SettingsContentViewController(url: url)
Expand Down

0 comments on commit b99bc86

Please sign in to comment.