Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix back button menus with empty titles #978

Merged
merged 2 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Stepic/Sources/Controllers/StyledNavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,16 @@ class StyledNavigationController: UINavigationController {
return
}

parentViewController.navigationItem.backBarButtonItem = UIBarButtonItem(
title: "",
style: .plain,
target: nil,
action: nil
)
if #available(iOS 14.0, *) {
parentViewController.navigationItem.backButtonDisplayMode = .minimal
} else {
parentViewController.navigationItem.backBarButtonItem = UIBarButtonItem(
title: "",
style: .plain,
target: nil,
action: nil
)
}
}

/// Change color of navigation bar & status bar background
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ final class CodeQuizFullscreenViewController: TabmanViewController {
Appearance.navigationBarAppearance.shadowViewAlpha,
sender: self
)
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)

if #available(iOS 14.0, *) {
self.navigationItem.backButtonDisplayMode = .minimal
} else {
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
}
}

override func viewWillDisappear(_ animated: Bool) {
Expand Down
7 changes: 6 additions & 1 deletion Stepic/Sources/Modules/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ final class SettingsViewController: UIViewController {
private func setupNavigationItem() {
self.title = NSLocalizedString("SettingsTitle", comment: "")
self.navigationItem.rightBarButtonItem = self.closeBarButtonItem
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)

if #available(iOS 14.0, *) {
self.navigationItem.backButtonDisplayMode = .minimal
} else {
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
}
}

private func updateNavigationBarAppearance() {
Expand Down