From df43dad23e8488934c7d6207c4d952ec16958b4e Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sat, 27 Apr 2019 17:21:29 -0500 Subject: [PATCH] Hack around UIKit bug in static tables with dynamic type --- iOS/Settings/SettingsViewController.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 8ba973316..1e3e4d230 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -16,6 +16,12 @@ class SettingsViewController: UITableViewController { weak var presentingParentController: UIViewController? + override func viewDidLoad() { + // This hack mostly works around a bug in static tables with dynamic type. See: https://spin.atomicobject.com/2018/10/15/dynamic-type-static-uitableview/ + NotificationCenter.default.removeObserver(tableView!, name: UIContentSizeCategory.didChangeNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil) + } + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) @@ -88,6 +94,10 @@ class SettingsViewController: UITableViewController { } } + @objc func contentSizeCategoryDidChange() { + tableView.reloadData() + } + } // MARK: OPML Document Picker