diff --git a/XBMC Remote/AppDelegate.m b/XBMC Remote/AppDelegate.m index 0a534cfae..7a6d03507 100644 --- a/XBMC Remote/AppDelegate.m +++ b/XBMC Remote/AppDelegate.m @@ -110,12 +110,14 @@ - (void)registerDefaultsFromSettingsBundle { } - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { - // iOS 13 and later use appearance for the navigationbar, from iOS 15 this is required as it else defaults to unwanted transparency + // Make navigation bar transparent if (@available(iOS 13, *)) { UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init]; [appearance configureWithOpaqueBackground]; + [appearance configureWithTransparentBackground]; + appearance.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; appearance.titleTextAttributes = @{NSForegroundColorAttributeName : UIColor.whiteColor}; - appearance.backgroundColor = NAVBAR_TINT_COLOR; + appearance.backgroundColor = UIColor.clearColor; [UINavigationBar appearance].standardAppearance = appearance; [UINavigationBar appearance].scrollEdgeAppearance = appearance; } diff --git a/XBMC Remote/DetailViewController.m b/XBMC Remote/DetailViewController.m index ec0ab777d..941bd114c 100644 --- a/XBMC Remote/DetailViewController.m +++ b/XBMC Remote/DetailViewController.m @@ -1058,11 +1058,9 @@ - (void)showMore { if (moreItemsViewController == nil) { moreItemsViewController = [[MoreItemsViewController alloc] initWithFrame:CGRectMake(dataList.bounds.size.width, 0, dataList.bounds.size.width, dataList.bounds.size.height) mainMenu:moreMenu]; moreItemsViewController.view.backgroundColor = UIColor.clearColor; - UIEdgeInsets tableViewInsets = UIEdgeInsetsZero; - tableViewInsets.bottom = buttonsViewBgToolbar.frame.size.height; - moreItemsViewController.tableView.contentInset = tableViewInsets; - moreItemsViewController.tableView.scrollIndicatorInsets = tableViewInsets; - [moreItemsViewController.tableView setContentOffset:CGPointMake(0, - tableViewInsets.top) animated:NO]; + moreItemsViewController.tableView.contentInset = activeLayoutView.contentInset; + [self setViewInset:moreItemsViewController.tableView bottom:buttonsViewBgToolbar.frame.size.height]; + [moreItemsViewController.tableView setContentOffset:CGPointMake(0, -moreItemsViewController.tableView.contentInset.top) animated:NO]; [maskView insertSubview:moreItemsViewController.view aboveSubview:dataList]; } @@ -1910,13 +1908,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender { } else if (sender.currentIndex == 0) { if (enableCollectionView) { - [collectionView setContentOffset:CGPointZero animated:NO]; + [collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO]; if (sectionNameOverlayView == nil && stackscrollFullscreen) { [self initSectionNameOverlayView]; } } else { - [dataList setContentOffset:CGPointZero animated:NO]; + [dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO]; } sectionNameLabel.text = @"🔍"; return; @@ -1957,7 +1955,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender { if (index != NSNotFound) { NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0]; [collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO]; - collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT); + collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]); } return; } @@ -2120,6 +2118,10 @@ - (void)setCellLayoutParameters { #pragma mark - Table Management +- (CGFloat)getTableInsetTop { + return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0; +} + - (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark { if (isDark) { searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE; @@ -5478,7 +5480,7 @@ - (void)buildButtons:(int)activeTab { // no button, no toolbar button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES; frame = dataList.frame; - frame.size.height = self.view.bounds.size.height; + frame.size.height = maskView.bounds.size.height; dataList.frame = frame; break; case 1: @@ -5828,7 +5830,7 @@ - (void)viewDidLoad { [self initSearchController]; self.navigationController.view.backgroundColor = UIColor.blackColor; self.definesPresentationContext = NO; - iOSYDelta = self.searchController.searchBar.frame.size.height; + iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop]; dataList.tableHeaderView = [self createFakeSearchbarInDark:NO]; if (@available(iOS 15.0, *)) { @@ -5839,11 +5841,16 @@ - (void)viewDidLoad { [button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside]; self.edgesForExtendedLayout = UIRectEdgeNone; + UIEdgeInsets viewInsets = dataList.contentInset; + viewInsets.top = [self getTableInsetTop]; + dataList.contentInset = viewInsets; dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault; - CGRect frame = dataList.frame; - frame.size.height = self.view.bounds.size.height; - dataList.frame = frame; + CGRect frame = maskView.frame; + frame.origin.y -= [self getTableInsetTop]; + frame.size.height += [self getTableInsetTop]; + maskView.frame = frame; + buttonsViewBgToolbar.hidden = NO; __weak DetailViewController *weakSelf = self; diff --git a/XBMC Remote/Utilities.m b/XBMC Remote/Utilities.m index 3c29f1879..6c80460cf 100644 --- a/XBMC Remote/Utilities.m +++ b/XBMC Remote/Utilities.m @@ -965,7 +965,14 @@ + (CGFloat)getTopPadding { } + (CGFloat)getTopPaddingWithNavBar:(UINavigationController*)navCtrl { - CGFloat topPadding = UIApplication.sharedApplication.statusBarFrame.size.height + navCtrl.navigationBar.frame.size.height; + // Workaround: Using CGRectGetMaxY resolves a layout issue where otherwise the inset ends below the navbar (e.g. + // iPhone 14 Pro iOS18), but at the same time it causes an issue with the inset not taking into account the status + // bar (e.g. iPod Touch iOS15.5). This seems to be caused by calling this method from viewDidLoad instead + // of willLayoutSubviews. This workaround avoids rework of DetailVC's delicate layout. + CGFloat topPadding = CGRectGetMaxY(navCtrl.navigationBar.frame); + if (topPadding <= navCtrl.navigationBar.frame.size.height) { + topPadding = UIApplication.sharedApplication.statusBarFrame.size.height + navCtrl.navigationBar.frame.size.height; + } return topPadding; }