-1

I'm working on an old Objective-C project and I'm trying to adapt iOS 26 and liquid glass to current UI. I'm facing an issue that the three dot buttons won't automatically move inside navigation item bar/group after resizing window, instead it displays on top of the navigation left item.

App runs entirely on iPad.

What I tried:

  • Added Application Scene Manifest to Info.plist

  • Added SceneDelegate and initialized window by windowScene but most old code are still inside AppDelegate

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    
    var window: UIWindow?
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let scene = (scene as? UIWindowScene) else { return }
        
        window = UIWindow(windowScene: scene)
        window?.isHidden = false
        appDelegate.window = window
        appDelegate.initWithWindow()
    }
}
- (void)initWithWindow {
    ...
    [self initViewControllers];   
    NSArray *tabArray = [self getTabArray];
    self.mainTabVC = [[MainTabBarViewController alloc] init:tabArray];  
    self.window.rootViewController = self.mainTabVC;
    [self.window setHidden:false];
    ...
}
  • Added these 2 delegate functions to AppDelegate

What I'm trying to achieve:

EDIT:

  • I moved all logic codes to SceneDelegate, now AppDelegate wouldn't do anything.
  • How navigation controller is created:
let bookmark = BookmarksTabViewController(nibName: "BookmarksTabViewController", bundle: nil)
        
        bookmarkNavigationController = UINavigationController(rootViewController: bookmark)
  • How navigation button is added:
self.clearAllBarButton = [[UIBarButtonItem alloc] initWithTitle:@"C" style:UIBarButtonItemStylePlain target:self action:@selector(clearAllButtonPressed)];
    self.clearAllBarButton.tintColor = UIColor.redColor;
self.navigationItem.leftBarButtonItems = @[self.clearAllBarButton];

There is no other logic related to navigation controller or item. Issue still stays the same.

EDIT 2:

After updating to iOS 26 and Xcode beta 4, the three buttons doesn't overlap my left navigation item anymore, but is still different than other apps.

2
  • You are not showing enough relevant code for how you setup the nav bar. I'm not seeing the same issue in my own app so you must be doing something wrong in code you haven't shown. However, the setup you do show is pretty unusual. Your Info.plist indicates that you are using Main storyboard but your code shows that you do everything in code without a storyboard. It's very unusual to have your scene delegate pass off its window to the app delegate and then have the app delegate setup the root controller. The scene delegate should be doing all of the scene setup. The app delegate should do none. Commented Jul 22 at 2:08
  • self.clearAllBarButton = [[UIBarButtonItem alloc] initWithTitle:@"C" style:UIBarButtonItemStylePlain target:self action:@selector(clearAllButtonPressed)]; self.clearAllBarButton.tintColor = UIColor.redColor; self.navigationItem.leftBarButtonItems = @[self.clearAllBarButton]; This is how I setup my button. Navigation controller is initialized normally. You are right that it's unusual to passing the window between AppDelegate and SceneDelegate, I only moved the creating window code to SceneDelegate with thoughts that only that related to this issue, other functions aren't relevant Commented Jul 22 at 5:33

2 Answers 2

-1

Today when I try to resize the window, I find out that it can't be resized freely like other apps (reduce width, height) and I can only make it smaller but with the same ratio. Turn out it is the UIRequiresFullScreen key (second one from my Info.plist) that keeps the window to be fully displayed or at least kept the default ratio. Removing or changing it to NO/false solves the issue.

Sign up to request clarification or add additional context in comments.

Comments

-2

Use UINavigationBarAppearance (iOS 13+). Ensure you're using the modern appearance API to configure your navigation bar properly:

if (@available(iOS 13.0, *)) {
    UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
    [appearance configureWithOpaqueBackground];
    appearance.backgroundColor = [UIColor systemBackgroundColor];

    self.navigationController.navigationBar.standardAppearance = appearance;
    self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
}

Avoid using custom views in UIBarButtonItem. Avoid this:

UIBarButtonItem *customItem = [[UIBarButtonItem alloc] initWithCustomView:myView];

1 Comment

Im pretty sure UINavigationBarAppearance has nothing to do with this and Im using UIBarButtonItem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.