Post

Replies

Boosts

Views

Activity

Reply to Window Control Placement Notification in iPadOS 26
Good news! On iPad—in both landscape and portrait—there’s room for a status bar in my app. With it enabled, everything works perfectly on both the main screen and the settings screen: the window control is inserted into the status bar as shown in the video, and you don’t need to use the UILayoutGuide discussed there. As expected, the settings screen is positioned below the status bar, so the left-bar button is no longer obscured by the window controls. On iPhone in landscape, there isn’t room for a status bar, but you can handle this by implementing prefersStatusBarHidden. Since multitasking is only available on iPadOS 26, this is the simplest solution on iPhone.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’25
Reply to Window Control Placement Notification in iPadOS 26
That doesn’t solve my issue: The video only handles cases where a navigation bar is already at the top of the main screen. Please advise what can be done if this is not the case (as for my main screen). On my settings screen (a table view with a navigation bar on top), I implemented your sample code, but the left-bar button on the navigation controller’s bar still doesn’t move and remains covered by the window controls. I must be doing something wrong. Based on another user’s suggestion and also your video, I tried using UISceneWindowingControlStyleMinimal in my SceneDelegate.
Still about a third of the left-bar button is obscured by the window controls. Here’s my Objective-C code (based on your Swift code) in the navigation bar subclass: UIView *containerView = self.view; UIView *contentView = self.navigationBar; UILayoutGuide *contentGuide; UIViewLayoutRegion *marginsRegion = [UIViewLayoutRegion marginsLayoutRegionWithCornerAdaptation: UIViewLayoutRegionAdaptivityAxisHorizontal]; contentGuide = [containerView layoutGuideForLayoutRegion:marginsRegion]; // Pin all four edges of the content view to that guide [NSLayoutConstraint activateConstraints:@[ [contentView.topAnchor constraintEqualToAnchor:contentGuide.topAnchor], [contentView.leadingAnchor constraintEqualToAnchor:contentGuide.leadingAnchor], [contentView.bottomAnchor constraintEqualToAnchor:contentGuide.bottomAnchor], [contentView.trailingAnchor constraintEqualToAnchor:contentGuide.trailingAnchor], ]];
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’25
Reply to iPadOS 26: App Window Controls Overlap Navigation Bar Buttons - Seeking Opt-Out Option (iPad 11th Gen, Objective-C)
I tried implementing the code, but the leftBarItem button on the navigation controller’s bar isn’t moving and is now unfortunately covered by the window’s controls. Apparently I’m doing something wrong. Here’s my Objective-C code: UIView *containerView = self.view; UIView *contentView = self.navigationBar; UILayoutGuide contentGuide; UIViewLayoutRegion marginsRegion = [UIViewLayoutRegion marginsLayoutRegionWithCornerAdaptation:UIViewLayoutRegionAdaptivityAxisHorizontal]; contentGuide = [containerView layoutGuideForLayoutRegion:marginsRegion]; // Pin all four edges of the content view to that guide [NSLayoutConstraint activateConstraints:@[[contentView.topAnchor constraintEqualToAnchor:contentGuide.topAnchor], [contentView.leadingAnchor constraintEqualToAnchor:contentGuide.leadingAnchor], [contentView.bottomAnchor constraintEqualToAnchor:contentGuide.bottomAnchor], [contentView.trailingAnchor constraintEqualToAnchor:contentGuide.trailingAnchor], ]];
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’25
Reply to Handling trait changes (for dark mode)
Hi Scott, Thank you very much for your input, it now works. Did not know this notation: UITraitUserInterfaceStyle.self It seems to be the same as UITraitUserInterfaceStyle.class which is perhaps a more intuitive notation? Anyway, both notations work, super! I'm mainly programming in C and always a bit afraid that memory is freed behind the scenes. But will give ARC a serious try. Thanks for the suggestion.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’23
Reply to Handling trait changes (for dark mode)
Tried the following in Objective C: UITraitUserInterfaceStyle* style = [[UITraitUserInterfaceStyle alloc] init]; NSArray* traits = [[NSArray alloc] initWithObjects: style, nil]; [self registerForTraitChanges:traits withTarget:self action:@selector(handleStyleChange)]; [traits release]; [style release]; Unfortunately, this crashes in registerForTraitChanges: UIKitCore`-[UIViewController registerForTraitChanges:withTarget:action:]: 0x1acce3f90 <+60>: bl 0x1acf55568 ; +[UITraitCollection _traitTokensIncludingPlaceholdersForTraits:] -> 0x1acce3f94 <+64>: bl 0x1afc953c0
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’23