Skip to content

Commit

Permalink
Fix iOS 18 bug with tab bar scroll edge appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNatan committed Oct 25, 2024
1 parent dc3af63 commit 42c363f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,17 @@ - (void)_ln_willTransitionToTraitCollection:(UITraitCollection *)newCollection w
}

[self _ln_willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];

if(@available(iOS 18.0, *))
{
if([self isKindOfClass:UITabBarController.class])
{
[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
static SEL sel = NSSelectorFromString(LNPopupHiddenString("_forceUpdateScrollViewIfNecessary"));
[self performSelector:sel];
}];
}
}
}

- (UIViewController*)_findAncestorParentPopupContainerController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "1.3">
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down Expand Up @@ -37,9 +37,11 @@
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugDocumentVersioning = "NO"
debugXPCServices = "NO"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
allowLocationSimulation = "YES"
queueDebuggingEnabled = "No">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class DemoAlbumTableViewController: UITableViewController {
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
#if LNPOPUP
#if LNPOPUP
let popupContentController = DemoMusicPlayerController()
popupContentController.songTitle = titles[(indexPath as NSIndexPath).row]
popupContentController.albumTitle = subtitles[(indexPath as NSIndexPath).row]
Expand All @@ -131,7 +131,7 @@ class DemoAlbumTableViewController: UITableViewController {
tabBarController?.popupBar.tintColor = UIColor.label
tabBarController?.popupBar.progressViewStyle = .top

#endif
#endif

tableView.deselectRow(at: indexPath, animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ protocol Indexable {
class _ScrollingColorsPageViewController<T: UIViewController & Indexable>: UIPageViewController, UIPageViewControllerDataSource {
override func viewDidLoad() {
super.viewDidLoad()
#if LNPOPUP
let useCompact = UserDefaults.settings.integer(forKey: .barStyle) == LNPopupBar.Style.compact.rawValue

let gridBarButtonItem = UIBarButtonItem()
gridBarButtonItem.image = LNSystemImage("rectangle.portrait.fill", scale: useCompact ? .compact : .normal)
popupItem.barButtonItems = [gridBarButtonItem]

LNApplyTitleWithSettings(to: self)
#endif

dataSource = self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ class ScrollingMapViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

#if LNPOPUP
let useCompact = UserDefaults.settings.integer(forKey: .barStyle) == LNPopupBar.Style.compact.rawValue

let gridBarButtonItem = UIBarButtonItem()
gridBarButtonItem.image = LNSystemImage("map", scale: useCompact ? .compact : .normal)
popupItem.barButtonItems = [gridBarButtonItem]

LNApplyTitleWithSettings(to: self)
#endif
}
}

0 comments on commit 42c363f

Please sign in to comment.