Skip to content

Commit 392dc55

Browse files
committed
Update demo project
1 parent 37a5b9d commit 392dc55

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

LNPopupControllerExample/LNPopupControllerExample/TestingScene/DemoViewController.m

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ - (void)viewDidLoad
152152
self.view.backgroundColor = UIColor.systemBackgroundColor;
153153
}
154154

155-
[self updateHideTabBarButtonHiddenState];
155+
[self updateHideTabBarButtonHiddenStateForTraitCollection:self.traitCollection];
156156

157157
// UIViewController* settings = [self.storyboard instantiateViewControllerWithIdentifier:@"Settings"];
158158
// [self addChildViewController:settings];
@@ -232,16 +232,27 @@ - (void)viewDidDisappear:(BOOL)animated
232232
[super viewDidDisappear:animated];
233233
}
234234

235-
- (void)updateHideTabBarButtonHiddenState
235+
- (void)updateHideTabBarButtonHiddenStateForTraitCollection:(UITraitCollection*)traitCollection;
236236
{
237237
if(@available(iOS 18.0, *))
238238
{
239+
if(traitCollection == nil)
240+
{
241+
traitCollection = self.traitCollection;
242+
}
243+
239244
if(self.tabBarController != nil)
240245
{
241246
[self.navigationItem setHidesBackButton:self.tabBarController.sidebar.isHidden == NO];
242247
}
243248

244-
_hideTabBarButton.hidden = (self.tabBarController == nil && self.navigationController == nil) || self.tabBarController.sidebar.isHidden == NO;
249+
BOOL isFirst = [self.navigationController.viewControllers indexOfObject:self] == 0;
250+
BOOL isTNil = self.tabBarController == nil;
251+
BOOL isNNil = self.navigationController == nil;
252+
BOOL canHaveSidebar = UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad && traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular;
253+
BOOL isSidebarHidden = self.tabBarController.sidebar.isHidden;
254+
255+
_hideTabBarButton.hidden = isFirst == NO || (isTNil && isNNil) || (canHaveSidebar && isSidebarHidden == NO);
245256
}
246257
else
247258
{
@@ -264,7 +275,7 @@ - (void)viewWillLayoutSubviews
264275
{
265276
if(self.tabBarController != nil)
266277
{
267-
[self updateHideTabBarButtonHiddenState];
278+
[self updateHideTabBarButtonHiddenStateForTraitCollection:self.traitCollection];
268279
}
269280
}
270281
}

LNPopupSettings

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LNPopupController
22

3-
`LNPopupController` is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
3+
LNPopupController is a framework for presenting view controllers as popups of other view controllers, similar to the Apple Music and Podcasts mini-players.
44

55
For SwiftUI, check out the [LNPopupUI library](https://github.com/LeoNatan/LNPopupUI).
66

0 commit comments

Comments
 (0)