-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/pre_beta' into develop
- Loading branch information
Showing
6 changed files
with
154 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// CustomNavigationController.swift | ||
// Kukai Mobile | ||
// | ||
// Created by Simon Mcloughlin on 01/05/2024. | ||
// | ||
|
||
import UIKit | ||
|
||
class CustomNavigationController: UINavigationController { | ||
|
||
override func viewDidLayoutSubviews() { | ||
super.viewDidLayoutSubviews() | ||
|
||
updateNavBar() | ||
} | ||
|
||
func updateNavBar() { | ||
for view in self.navigationBar.subviews { | ||
|
||
let string = "\(view.classForCoder)" | ||
if string.contains("ContentView") { | ||
|
||
// Adjust left and right constraints of the content view | ||
for constraint in view.constraints { | ||
if constraint.firstAttribute == .leading || constraint.secondAttribute == .leading { | ||
|
||
if constraint.constant > 12 { | ||
constraint.constant = 16 | ||
} | ||
|
||
} else if constraint.firstAttribute == .trailing || constraint.secondAttribute == .trailing { | ||
|
||
if constraint.constant < -12 { | ||
constraint.constant = -16 | ||
} | ||
} | ||
} | ||
|
||
// Adjust constraints between items in stack view | ||
for subview in view.subviews { | ||
|
||
if subview is UIStackView { | ||
for constraint in subview.constraints { | ||
if constraint.firstAttribute == .width || constraint.secondAttribute == .width { | ||
constraint.constant = 0 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.