mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Fixes tapping buttons underneath navigation bar on SourceDetailViewController/AppViewController
This commit is contained in:
@@ -416,15 +416,17 @@ private extension AppViewController
|
|||||||
// Copied from HeaderContentViewController
|
// Copied from HeaderContentViewController
|
||||||
func updateNavigationBarAppearance(isHidden: Bool)
|
func updateNavigationBarAppearance(isHidden: Bool)
|
||||||
{
|
{
|
||||||
let barAppearance = self.navigationItem.standardAppearance ?? UINavigationBarAppearance()
|
let barAppearance = self.navigationItem.standardAppearance as? NavigationBarAppearance ?? NavigationBarAppearance()
|
||||||
|
|
||||||
if isHidden
|
if isHidden
|
||||||
{
|
{
|
||||||
barAppearance.configureWithTransparentBackground()
|
barAppearance.configureWithTransparentBackground()
|
||||||
|
barAppearance.ignoresUserInteraction = true
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
barAppearance.configureWithDefaultBackground()
|
barAppearance.configureWithDefaultBackground()
|
||||||
|
barAppearance.ignoresUserInteraction = false
|
||||||
}
|
}
|
||||||
|
|
||||||
barAppearance.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
barAppearance.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
||||||
|
|||||||
@@ -481,15 +481,17 @@ private extension HeaderContentViewController
|
|||||||
|
|
||||||
func updateNavigationBarAppearance(isHidden: Bool)
|
func updateNavigationBarAppearance(isHidden: Bool)
|
||||||
{
|
{
|
||||||
let barAppearance = self.navigationItem.standardAppearance ?? UINavigationBarAppearance()
|
let barAppearance = self.navigationItem.standardAppearance as? NavigationBarAppearance ?? NavigationBarAppearance()
|
||||||
|
|
||||||
if isHidden
|
if isHidden
|
||||||
{
|
{
|
||||||
barAppearance.configureWithTransparentBackground()
|
barAppearance.configureWithTransparentBackground()
|
||||||
|
barAppearance.ignoresUserInteraction = true
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
barAppearance.configureWithDefaultBackground()
|
barAppearance.configureWithDefaultBackground()
|
||||||
|
barAppearance.ignoresUserInteraction = false
|
||||||
}
|
}
|
||||||
|
|
||||||
barAppearance.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
barAppearance.titleTextAttributes = [.foregroundColor: UIColor.clear]
|
||||||
|
|||||||
@@ -12,6 +12,20 @@ import Roxas
|
|||||||
|
|
||||||
final class NavigationBar: UINavigationBar
|
final class NavigationBar: UINavigationBar
|
||||||
{
|
{
|
||||||
|
// We sometimes need to ignore user interaction so
|
||||||
|
// we can tap items underneath the navigation bar.
|
||||||
|
var ignoresUserInteraction: Bool = false
|
||||||
|
|
||||||
|
override func copy(with zone: NSZone? = nil) -> Any
|
||||||
|
{
|
||||||
|
let copy = super.copy(with: zone) as! NavigationBarAppearance
|
||||||
|
copy.ignoresUserInteraction = self.ignoresUserInteraction
|
||||||
|
return copy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NavigationBar: UINavigationBar
|
||||||
|
{
|
||||||
@IBInspectable var automaticallyAdjustsItemPositions: Bool = true
|
@IBInspectable var automaticallyAdjustsItemPositions: Bool = true
|
||||||
|
|
||||||
private let backgroundColorView = UIView()
|
private let backgroundColorView = UIView()
|
||||||
@@ -80,4 +94,15 @@ final class NavigationBar: UINavigationBar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView?
|
||||||
|
{
|
||||||
|
if let appearance = self.topItem?.standardAppearance as? NavigationBarAppearance, appearance.ignoresUserInteraction
|
||||||
|
{
|
||||||
|
// Ignore touches.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.hitTest(point, with: event)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user