HomeiOS DevelopmentiOS26 - Surprising shadow/background colour when presenting UIMenu from UIBarButtonItem

iOS26 – Surprising shadow/background colour when presenting UIMenu from UIBarButtonItem


I work in a big and previous codebase. I’m at the moment engaged on implementing the Liquid Glass design in our app, however I’m caught on one element that I can not resolve.

Situation:
I open a UIMenu containing a number of fundamental actions from a UIBarButtonItem. The transition occurs mechanically and the UI is okay. Nonetheless, a “shadow” or “background colour” is seen after the UIMenu is opened (see screenshot).
iOS26 – Surprising shadow/background colour when presenting UIMenu from UIBarButtonItem

I wish to make clear that I didn’t write a customized UI for this myself. I create a UIMenu after which cross it on throughout the initialization of the UIBarButtonItem. See the initialization beneath.

Initialization:

-(UIBarButtonItem *)getActionsBarButtonItem {
NSMutableArray<UIAction *> *basicActions = [NSMutableArray array];

    UIAction *editAction = [UIAction actionWithTitle:@"Edit"
                                                image:[UIImage systemImageNamed:@"pencil"]
                                           identifier:nil
                                              handler:^(UIAction *motion) {
        NSLog(@"Edit motion tapped");
    }];
    [basicActions addObject:editAction];
    
    UIAction *removeAction = [UIAction actionWithTitle:@"Remove"
                                                   image:[UIImage systemImageNamed:@"trash"]
                                              identifier:nil
                                                 handler:^(UIAction *motion) {
        NSLog(@"Take away motion tapped");
    }];
    [basicActions addObject:removeAction];

UIAction *copyAction = [UIAction actionWithTitle:@"Copy"
                                              image:[UIImage systemImageNamed:@"document.on.document"]
                                         identifier:nil
                                            handler:^(UIAction *motion) {
    NSLog(@"Take away motion tapped");
}];
[basicActions addObject:copyAction];

UIMenu *editMenu = [UIMenu menuWithTitle:@"" children:basicActions];

return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit menu:editMenu];
}

Assign to the toolbar:

- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *actionsButton = [self getActionsBarButtonItem];
NSMutableArray *buttons = [NSMutableArray array];
[buttons addObject:actionsButton];

 // Add different buttons relying on some situations
        
self.toolbarItems = buttons;
}

After I view the View Hierarchy through Xcode, it seems that the _UIContextMenuView has no nook radius, which causes this. (Aspect notice: I do not know if that is truly the issue—that is simply what I can inform from the View Hierarchy).

Does anybody else have the identical drawback or an answer for this? I might love to listen to your opinions on this.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments