diff options
| author | Sajad Vishkai <sajaclvishkai@gmail.com> | 2022-09-26 12:01:54 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2022-09-26 16:31:21 +0200 |
| commit | 542a8df389f1f3996eb03bff6d2937e1fb1007d5 (patch) | |
| tree | ea306660ccd97f497a671dce9606f147c94ba5ca | |
| parent | 75d8a47fc2fac9c5ca82c62b06076b06e1034344 (diff) | |
| download | mullvadvpn-542a8df389f1f3996eb03bff6d2937e1fb1007d5.tar.xz mullvadvpn-542a8df389f1f3996eb03bff6d2937e1fb1007d5.zip | |
Update SettingsCell.swift
Reverted required init back.
| -rw-r--r-- | ios/MullvadVPN/SelectLocationNavigationController.swift | 4 | ||||
| -rw-r--r-- | ios/MullvadVPN/SettingsCell.swift | 46 |
2 files changed, 4 insertions, 46 deletions
diff --git a/ios/MullvadVPN/SelectLocationNavigationController.swift b/ios/MullvadVPN/SelectLocationNavigationController.swift index 1a46fcb3a0..a88c87c907 100644 --- a/ios/MullvadVPN/SelectLocationNavigationController.swift +++ b/ios/MullvadVPN/SelectLocationNavigationController.swift @@ -23,4 +23,8 @@ class SelectLocationNavigationController: UINavigationController { viewControllers = [contentController] } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } } diff --git a/ios/MullvadVPN/SettingsCell.swift b/ios/MullvadVPN/SettingsCell.swift index 99fe94d4d7..6dbaa66cc8 100644 --- a/ios/MullvadVPN/SettingsCell.swift +++ b/ios/MullvadVPN/SettingsCell.swift @@ -115,16 +115,6 @@ class SettingsCell: UITableViewCell { setLayoutMargins() } - override func layoutSubviews() { - super.layoutSubviews() - - if #available(iOS 13, *) { - // no-op - } else { - layoutSubviews_iOS12() - } - } - private func setLayoutMargins() { // Set layout margins for standard acceessories added into the cell (reorder control, etc..) layoutMargins = UIMetrics.settingsCellLayoutMargins @@ -132,40 +122,4 @@ class SettingsCell: UITableViewCell { // Set layout margins for cell content contentView.layoutMargins = UIMetrics.settingsCellLayoutMargins } - - /// On iOS 12, standard edit and reorder controls do not respect layout margins. - /// This method does layout adjustments to fix that. - private func layoutSubviews_iOS12() { - guard isEditing || showsReorderControl else { return } - - var leftOffset: CGFloat = 0 - var rightOffset: CGFloat = 0 - - for subview in subviews { - // Detect the edit control and move it, so that the nested image view is aligned along the left edge of the - // layout margins. - if subview.description.starts(with: "<UITableViewCellEditControl"), - let imageView = subview.subviews.first - { - let imageOffset = imageView.frame.minX - var pos = subview.frame.origin - pos.x = layoutMargins.left - imageOffset - subview.frame.origin = pos - leftOffset = pos.x - } - - // Detect the reorder control and move it, so that its right edge is aligned along the right edge of the - // layout margins. - if subview.description.starts(with: "<UITableViewCellReorderControl") { - var pos = subview.frame.origin - pos.x -= layoutMargins.right - subview.frame.origin = pos - rightOffset = layoutMargins.right - } - } - - // Adjust the content view to account for the adjustments to the edit and reorder controls. - let contentInset = UIEdgeInsets(top: 0, left: leftOffset, bottom: 0, right: rightOffset) - contentView.frame = contentView.frame.inset(by: contentInset) - } } |
