File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -249,20 +249,29 @@ - (void)updateMenuSelection:(NSString *)selectedIdentifier
249249 if ([element isKindOfClass: [UIAction class ]]) {
250250 UIAction *oldAction = (UIAction *)element;
251251
252+ // Create new action with handler that captures the identifier and title
252253 UIAction *newAction = [UIAction actionWithTitle: oldAction.title
253254 image: oldAction.image
254255 identifier: oldAction.identifier
255256 handler: ^(__kindof UIAction * _Nonnull action) {
256257 [self selectMenuItem: action.identifier title: action.title];
257258 }];
258259
260+ // Copy all relevant properties from oldAction to preserve behavior
261+ newAction.attributes = oldAction.attributes ;
262+
259263 // Update state based on current selection
260264 if (selectedIdentifier != nil && ![selectedIdentifier isEqualToString: @" " ] && [oldAction.identifier isEqualToString: selectedIdentifier]) {
261265 newAction.state = UIMenuElementStateOn;
262266 } else {
263267 newAction.state = UIMenuElementStateOff;
264268 }
265269
270+ // Copy discoverability title if present
271+ if (oldAction.discoverabilityTitle ) {
272+ newAction.discoverabilityTitle = oldAction.discoverabilityTitle ;
273+ }
274+
266275 [actions addObject: newAction];
267276 }
268277 }
You can’t perform that action at this time.
0 commit comments