Post

Replies

Boosts

Views

Activity

Reply to UISearchController scope buttons disappear forever after dismissing search when embedded in a search tab
I filed two related UISearchBar scope button bug reports against beta 1. Still not fixed as of beta 5. Though earlier today I found a work around that might work in your case too. Set the search controller scopeBarActivation to .manual. Set the controller’s delegate. In the didPresentSearchController delegate method, call setShowScope(true, animated: true) on the search bar. In the willDismissSearchController delegate method, call setShowScope(false, animated: true) on the search bar. The latter one is key. The result looks slightly clunky but at least the scope buttons appear more than once.
Topic: UI Frameworks SubTopic: UIKit Tags:
3w
Reply to Is there a tech note for menuBuilder?
My menu code is all in Objective-C too (old app still going). I've been using UIMenuBuilder since iOS 14 in support of macOS via Mac Catalyst. My proposed solution also works now on the iPad in iOS 26. Your case is slightly more complicated than mine. I support multiple scenes but all of the scenes are the same class with the same root view controller class. First, design your overall app menu taking into account the needs of general app-level menu items and items specific to each of your scenes' root view controllers. In the end you will have common menu items used by all scenes, you will have items specific to each scene, and you will have items that work even if there are no open scenes. Once you know all of the possible menu items, you will use UIMenuBuilder in the app delegate to build the entire possible menu structure. Then there will be validation code in the app delegate and each of your possible root view controllers. Each root view controller will only validate the items it can handle. For those it can't it calls super. And the app delegate handles what it can and for those it can't it disables them. With that general approach, if Scene A is in focus, then it validates its own specific menu item and punts to the app delegate for the rest. The app delegate will handle a few and disable the rest. This means that while Scene A is in focus, any menu items specific to Scene B will be disabled (in the app delegate by default). Here's some example skeleton code: In AppDelegate.m: - (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder { [super buildMenuWithBuilder:builder]; if (builder.system != UIMenuSystem.mainSystem) { return; } // Remove unwanted standard File menu: [builder removeMenuForIdentifier:UIMenuOpenRecent]; [builder removeMenuForIdentifier:UIMenuOpen]; [builder removeMenuForIdentifier:UIMenuDocument]; // Add some new File menu items UICommand *item1 = [UIKeyCommand commandWithTitle:@"Item 1" image:[UIImage systemImageNamed:@"some.symbol"] action:@selector(item1MenuAction:) input:@"I" modifierFlags:UIKeyModifierShift | UIKeyModifierCommand propertyList:nil]; UICommand *item2 = [UIKeyCommand commandWithTitle:@"Item 2" image:[UIImage systemImageNamed:@"other.symbol"] action:@selector(item2MenuAction:) input:@"J" modifierFlags:UIKeyModifierShift | UIKeyModifierCommand propertyList:nil]; UIMenu *extraItems = [UIMenu menuWithTitle:@"" image: nil identifier:nil options:UIMenuOptionsDisplayInline children:@[ item1, item2 ]]; // NO_I18N [builder insertSiblingMenu:extraItems afterMenuForIdentifier:UIMenuClose]; // Build everything else as needed } - (void)validateCommand:(UICommand *)command { // Handle App level items here if ( command.action == @selector(someMenuAction:) || command.action == @selector(otherMenuAction:) || NO) { command.attributes &= ~UIMenuElementAttributesDisabled; // Always on } else if ( command.action == @selector(anotherMenuAction:) || NO) { if (someCondition) { command.attributes &= ~UIMenuElementAttributesDisabled; } else { command.attributes |= UIMenuElementAttributesDisabled; } } else { [super validateCommand:command]; } } Now add a validateCommand: to each of your root view controller classes. It should validate each of its own commands as needed. Call super for all other commands. Tedious but straight forward.
Topic: UI Frameworks SubTopic: UIKit
3w
Reply to Is there a tech note for menuBuilder?
There’s a sample app you can refer to. Look at the documentation for UIMenuBuilder. The overview has a link to the “Adding menus and shortcuts to the menu bar and user interface” sample app. In short, the menu walks the responder chain to find the responder that handles the selector. This means the active window and its view hierarchy will be looked at to handle the menu. If your window’s rootViewController is where you handle the menu‘s selector then that controller should know its own document to handle. In my own app my main root view controller class handles most menu items. This makes it easy for a given window to handle and validate the menu. The app delegate is only used to handle and validate menu items that are not window specific.
Topic: UI Frameworks SubTopic: UIKit
4w
Reply to Setting Tint Color for Prominent Style UIBarButtonItems at App Level in iOS26
Another beta release and another round of disappointment. Not a single tint/color related issue was fixed in the beta 5. Two months of beta testing and Apple seems to want all of us to deliver purely black and white user interfaces. That or they are abandoning UIKit. I have a dozen open iOS 26 UIKit bugs. Many since beta 1. All include trivial sample apps that demonstrate the issue. And I’m talking about flat out broken behavior, not just things I wish were different. So frustrating.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to Unable to Tint Custom View in UIBarButtonItem on iOS 26
This has been an issue since iOS 26 beta 1. I filed a bug report then. Please do the same using the Feedback Assistant app. There are actually quite a few issues related to tinting bar button items in iOS 26. I've filed 4 separate bug reports so far (just for different tinting issues). Apple just doesn't seem to care about fixing basic UIKit bugs in iOS 26. It's frustrating. And every beta update introduces new issues related to colors. (sorry for the rant).
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’25
Reply to Missing StoreKit configuration file option in Xcode
You make no mention of where you are looking in Xcode for the option. First, you need to add the StoreKit configuration file to your project properly. Use Xcode -> File -> New -> File from template... Then on the template screen, scroll down to the "Other" section and select StoreKit Configuration File. Once that file is setup, you make use of it by going to Xcode -> Product -> Scheme -> Edit Scheme. Then select the "Run/Debug" tab on the left. Then select the Options tab on the right. There you will see the StoreKit Configuration option where you can select the configuration file you created as described above.
Jul ’25
Reply to Weird DateFormatter behavior
I take back what I said about .weekOfMonth. Once you ditch DateComponentsFormatter, you get the correct result, even with .weekOfMonth. 57: year: 0 month: 1 day: 5 weekOfMonth: 3 58: year: 0 month: 1 day: 6 weekOfMonth: 3 59: year: 0 month: 1 day: 0 weekOfMonth: 4 60: year: 0 month: 1 day: 1 weekOfMonth: 4 61: year: 0 month: 2 day: 0 weekOfMonth: 0 62: year: 0 month: 2 day: 1 weekOfMonth: 0 63: year: 0 month: 2 day: 2 weekOfMonth: 0
Topic: App & System Services SubTopic: General Tags:
Jul ’25