diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift index 8b7f2d9e91..3eb8f77a62 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/LanguageSettingsViewController.swift @@ -122,19 +122,33 @@ class LanguageSettingsViewController: UITableViewController { if 0 == indexPath.row { cell.accessoryType = .none let doPredictionsSwitch = UISwitch() + doPredictionsSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: doPredictionsSwitch.frame.size) doPredictionsSwitch.frame = switchFrame + doPredictionsSwitch.isOn = userDefaults.predictSettingForLanguage(languageID: self.language.id) doPredictionsSwitch.addTarget(self, action: #selector(self.predictionSwitchValueChanged), for: .valueChanged) cell.addSubview(doPredictionsSwitch) + if #available(iOSApplicationExtension 9.0, *) { + doPredictionsSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + doPredictionsSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } } else if 1 == indexPath.row { cell.accessoryType = .none let doCorrectionsSwitch = UISwitch() + doCorrectionsSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: doCorrectionsSwitch.frame.size) doCorrectionsSwitch.frame = switchFrame + doCorrectionsSwitch.isOn = userDefaults.correctSettingForLanguage(languageID: self.language.id) doCorrectionsSwitch.addTarget(self, action: #selector(self.correctionSwitchValueChanged), for: .valueChanged) cell.addSubview(doCorrectionsSwitch) + if #available(iOSApplicationExtension 9.0, *) { + doCorrectionsSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + doCorrectionsSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } } else { // rows 3 and 4 cell.accessoryType = .disclosureIndicator } diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard b/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard index c5b79081f8..f6328c5ada 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/Settings.storyboard @@ -1,10 +1,9 @@ - + - @@ -14,19 +13,19 @@ - + - + - + - + - + - - - + + + + + - + - + - - - + + + + + @@ -94,7 +97,7 @@ - + diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift index 09155dee56..0c63f04576 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Settings/SettingsViewController.swift @@ -118,34 +118,37 @@ open class SettingsViewController: UITableViewController { case "showbanner": cell.accessoryType = .none let showBannerSwitch = UISwitch() + showBannerSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: showBannerSwitch.frame.size) showBannerSwitch.frame = switchFrame + showBannerSwitch.isOn = false //TODO: find the setting this is to show! showBannerSwitch.addTarget(self, action: #selector(self.bannerSwitchValueChanged), for: .valueChanged) cell.addSubview(showBannerSwitch) + + if #available(iOSApplicationExtension 9.0, *) { + showBannerSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + showBannerSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } case "showgetstarted": cell.accessoryType = .none let dontShowAgainSwitch = UISwitch() -// let rightOffset = cell.frame.size.width -// let switchWidth: CGFloat = 20 -// let switchX = rightOffset - switchWidth -// let dontShowAgainSwitch = UISwitch() -// let switchHeight = dontShowAgainSwitch.frame.size.height -// let cellSwitchHeightDiff = cell.frame.size.height - switchHeight -// let switchY = cell.frame.origin.y + 0.5 * cellSwitchHeightDiff - -// let switchFrame = CGRect(x: switchX, -// y: switchY, -// width: switchWidth, -// height: cell.frame.size.height) + dontShowAgainSwitch.translatesAutoresizingMaskIntoConstraints = false + let switchFrame = frameAtRightOfCell(cell: cell.frame, controlSize: dontShowAgainSwitch.frame.size) dontShowAgainSwitch.frame = switchFrame + dontShowAgainSwitch.isOn = dontShowGetStarted dontShowAgainSwitch.addTarget(self, action: #selector(self.showGetStartedSwitchValueChanged), for: .valueChanged) cell.addSubview(dontShowAgainSwitch) - + + if #available(iOSApplicationExtension 9.0, *) { + dontShowAgainSwitch.rightAnchor.constraint(equalTo: cell.layoutMarginsGuide.rightAnchor).isActive = true + dontShowAgainSwitch.centerYAnchor.constraint(equalTo: cell.layoutMarginsGuide.centerYAnchor).isActive = true + } default: log.error("unknown cellIdentifier(\"\(cellIdentifier ?? "EMPTY")\")") cell.accessoryType = .none diff --git a/ios/history.md b/ios/history.md index 7d4a43b7a7..391265438c 100644 --- a/ios/history.md +++ b/ios/history.md @@ -3,6 +3,9 @@ ## 13.0 alpha * Start version 13.0 +## 2019-08-08 12.0.12 beta +* Fixes toggle alignment issues in the Settings UI (#1947) + ## 2019-07-29 12.0.11 beta * Initial beta release of Keyman for iPhone and iPad 12 * [Pull Requests](https://github.com/keymanapp/keyman/pulls?utf8=%E2%9C%93&q=is%3Apr+merged%3A2019-02-25..2019-08-04+label%3Aios+base%3Amaster)