Still broken on Ventura 13.5.2.
Also it doesn't work when creating a pull down UIButton. The following button just show "Loading..." and the provider block is never called:
UIDeferredMenuElement *deferredmenuElement;
deferredmenuElement = [UIDeferredMenuElement elementWithUncachedProvider:^(void (^ _Nonnull completion)(NSArray<UIMenuElement *> * _Nonnull))
{
UIAction *actionOne = [UIAction actionWithTitle:@"Action One"
image:nil
identifier:@"fake.action.test"
handler:^(__kindof UIAction * _Nonnull action) {
NSLog(@"action one fired.");
}];
completion(@[actionOne]);
}];
UIMenu *someMenu = [UIMenu menuWithChildren:@[deferredmenuElement]];
UIButton *pullDownButton = [UIButton buttonWithType:UIButtonTypeSystem];
[pullDownButton setTitle:@"Pull Down Button" forState:UIControlStateNormal];
[pullDownButton sizeToFit];
self.button = pullDownButton;
self.button.menu = someMenu;
self.button.showsMenuAsPrimaryAction = YES;
[self.view addSubview:pullDownButton];
//Position the button...
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: