Post

Replies

Boosts

Views

Activity

Reply to Mac Catalyst: UISplitViewControllerColumnSecondary doesn't get key focus when the Tab Key is Pressed in a Triple UISplitViewController.
Thanks a lot for the reply. I filed a feedback with a sample project and screen capture FB11745181. In the sample project I used a plain UIScrollview. Tabbing into it doesn't work. After fiddling with the quick sample I noticed that arrow key scrolling doesn't work at all (even when clicking on the scroll view). In the app I'm actually working on I'm using a WKWebView which does have arrow key scrolling implemented but was requiring at least a mouse click on the web view before it started working (couldn't tab in). It's hard to say what might be happening without a sample project, but — on the Mac — keyboard navigation is going to change first-responder, not focus. That's what I thought. I fiddled with calls to -becomeFirstResponder with no luck (on the view controller and on the web view itself). Subclassing and returning YES from -canBecomeFocused on the view is all I needed to do to get focus to move over with the tab key, without messing with the responder chain at all. But I also needed to implement my own key commands to actually do the scrolling now because the default web view ones don't work after these overrides.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’22
Reply to Determine selected text color to use in Mac Catalyst for UITableView Cells When Row is Selected But Table View Doesn't Have Active Focus?
So the "unemphasized" state happens even if the selected rows are in the active focus environment if a table view cell is swiped. There doesn't seem to be anything in the UICellConfigurationState to indicate this state, nor the trait collection. I don't see any properties that make it easy to detect for this "unemphasized" state. The workaround I came up with (limited testing) is to inspect the background color on the background configuration directly and compare it against the default tint color when the window is active....(using -traitCollectionWithActiveAppearance: and -performAsCurrent:). Code is pretty ugly.
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’22
Reply to Crash: Focus item <UITableViewCell> does not provide a parentFocusEnvironment.
So I'm going with the workaround above (for now at least). You have to be careful to ensure that you only set the fallback weak reference once (I'm doing it in -didAddSubview: from a UITableView subclass) and don't accidentally set it while the tableview is in the process of being torn down. Attempting to set it from within -parentFocusEnvironment can cause the weak reference crash since the focus system is very aggressive and it interrogates the focus environment during/after it has been removed from the window.
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’22
Reply to UINavigationController inside UISplitViewController's UISplitViewControllerColumnSupplementary Doesn't Appear on Mac Catalyst
So I can make the search bar and scope bar look reasonable by setting UISearchBar's backgroundImage and scopeBarBackgroundImage properties to a image of just a solid color, but my app also sets navigationItem.prompt when the UISearchController is active, and the background color of that view _UINavigationBarModernPromptView is white... Edit: setting UINavigationBarAppearance's backgroundColor allows me to get override the white background.
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’22
Reply to UICollectionView List Style on Mac Catalyst: Prevent the Collection View From Changing the Selection when the Selected Row's Parent is Collapsed?
Also not sure why focus moves to the first row (0,0) when another row is collapsed with the selected and focused row. If the collapsed parent (just clicked) isn't selectable but is focusable the focus should move to the clicked row. IMO it shouldn't jump to index path 0,0. Overriding this behavior is not as straightforward since the focus API gives developer's limited control. I have to hold the clicked index path in a property and return it from -indexPathForPreferredFocusedViewInCollectionView:
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’22
Reply to UICollectionView List Style on Mac Catalyst: Prevent the Collection View From Changing the Selection when the Selected Row's Parent is Collapsed?
Actually I get the behavior I expect by default as long as the selected row isn't also focused (the collection view is configured to have the selection follow focus, which is something I want). Only thing I can think of is to manually implement the expandable row's UICellAccessoryOutlineDisclosure actionHandler, set selectionFollowsFocus to NO before I collapse the row, then set selectionFollowsFocus to YES after the animation finishes. Feels like this is way more work then it should be though.
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’22
Reply to Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location
I think if figured out what's going on. On launch my app needs to determine whether or not it should show onboarding UI based on a few conditions. While my app is making this determination, I overlay a separate UIWindow in the UIWindowScene that shows a UIActivityIndicatorView. Then if I do in fact have to show the onboarding UI, this overlayed window shows the onboarding view controller by presenting it modally. Underneath this overlayed window is my standard UIWindow. In that window hierarchy underneath there is a UINavigationController with navigation bar. It appears UIKit on macOS draws this separator line underneath the navigation bar when the window is in certain states...but the separator is bleeding through from the UIWindow that's offscreen. That UIWindow should be completely offscreen while the overlay window is the key window (and it is, except for the line separator bleeding through and causing this glitch). So if I do this: #if TARGET_OS_MACCATALYST     [self setNavigationBarHidden:YES animated:NO];     #endif The line separator issue goes away.
Topic: App & System Services SubTopic: General Tags:
Oct ’22
Reply to Mac Catalyst: UISplitViewControllerColumnSecondary doesn't get key focus when the Tab Key is Pressed in a Triple UISplitViewController.
Thanks a lot for the reply. I filed a feedback with a sample project and screen capture FB11745181. In the sample project I used a plain UIScrollview. Tabbing into it doesn't work. After fiddling with the quick sample I noticed that arrow key scrolling doesn't work at all (even when clicking on the scroll view). In the app I'm actually working on I'm using a WKWebView which does have arrow key scrolling implemented but was requiring at least a mouse click on the web view before it started working (couldn't tab in). It's hard to say what might be happening without a sample project, but — on the Mac — keyboard navigation is going to change first-responder, not focus. That's what I thought. I fiddled with calls to -becomeFirstResponder with no luck (on the view controller and on the web view itself). Subclassing and returning YES from -canBecomeFocused on the view is all I needed to do to get focus to move over with the tab key, without messing with the responder chain at all. But I also needed to implement my own key commands to actually do the scrolling now because the default web view ones don't work after these overrides.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Mac Catalyst: UISplitViewControllerColumnSecondary doesn't get key focus when the Tab Key is Pressed in a Triple UISplitViewController.
Oh my I just discovered that UIScrollView doesn't have any implementation at all for scrolling with the arrow keys. Guess I'll try to have to subclass and try to implement it myself....
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Update title of NSMenuItem in Menu Bar on Mac Catalyst Based on Current Context?
Ah nice I found the answer. I have to override the -validateCommand: method.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to UITableView Doesn't Properly Update Focus When Extending Selection by Holding the Shift Key+Clicking on Mac Catalyst
I opened FB11733820
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Determine selected text color to use in Mac Catalyst for UITableView Cells When Row is Selected But Table View Doesn't Have Active Focus?
So the "unemphasized" state happens even if the selected rows are in the active focus environment if a table view cell is swiped. There doesn't seem to be anything in the UICellConfigurationState to indicate this state, nor the trait collection. I don't see any properties that make it easy to detect for this "unemphasized" state. The workaround I came up with (limited testing) is to inspect the background color on the background configuration directly and compare it against the default tint color when the window is active....(using -traitCollectionWithActiveAppearance: and -performAsCurrent:). Code is pretty ugly.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Crash: Focus item <UITableViewCell> does not provide a parentFocusEnvironment.
So I'm going with the workaround above (for now at least). You have to be careful to ensure that you only set the fallback weak reference once (I'm doing it in -didAddSubview: from a UITableView subclass) and don't accidentally set it while the tableview is in the process of being torn down. Attempting to set it from within -parentFocusEnvironment can cause the weak reference crash since the focus system is very aggressive and it interrogates the focus environment during/after it has been removed from the window.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to UINavigationController inside UISplitViewController's UISplitViewControllerColumnSupplementary Doesn't Appear on Mac Catalyst
So I can make the search bar and scope bar look reasonable by setting UISearchBar's backgroundImage and scopeBarBackgroundImage properties to a image of just a solid color, but my app also sets navigationItem.prompt when the UISearchController is active, and the background color of that view _UINavigationBarModernPromptView is white... Edit: setting UINavigationBarAppearance's backgroundColor allows me to get override the white background.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to UICollectionView List Style on Mac Catalyst: Prevent the Collection View From Changing the Selection when the Selected Row's Parent is Collapsed?
Also not sure why focus moves to the first row (0,0) when another row is collapsed with the selected and focused row. If the collapsed parent (just clicked) isn't selectable but is focusable the focus should move to the clicked row. IMO it shouldn't jump to index path 0,0. Overriding this behavior is not as straightforward since the focus API gives developer's limited control. I have to hold the clicked index path in a property and return it from -indexPathForPreferredFocusedViewInCollectionView:
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to UICollectionView List Style on Mac Catalyst: Prevent the Collection View From Changing the Selection when the Selected Row's Parent is Collapsed?
Actually I get the behavior I expect by default as long as the selected row isn't also focused (the collection view is configured to have the selection follow focus, which is something I want). Only thing I can think of is to manually implement the expandable row's UICellAccessoryOutlineDisclosure actionHandler, set selectionFollowsFocus to NO before I collapse the row, then set selectionFollowsFocus to YES after the animation finishes. Feels like this is way more work then it should be though.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Unable to get CloudKit sync Notifications on Mac Catalyst Build -application:didFailToRegisterForRemoteNotificationsWithError: is being called
So I deleted the "Push Notifications" entry in "Signing and Capabilities" then added it back. Remote notifications are working again. 🤷‍♂️
Topic: Code Signing SubTopic: Entitlements Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to UISplitViewController on Mac Catalyst Collapse the Primary (Sidebar) View Controller by Dragging the Split macOS Style?
I duped this thread in a feedback: FB11689969
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to UISplitViewController on Mac Catalyst Collapse the Primary (Sidebar) View Controller by Dragging the Split macOS Style?
Maybe it's not possible? I just tried to do it in the "Developer" app which I believe is a Catalyst app and it won't collapse the sidebar via drag. Notes, Mail, Xcode, Finder, etc. all allow you to collapse the sidebar by dragging the split.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location
I did open a feedback on this: FB11681351 duplicating the information I provided in this thread.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location
I think if figured out what's going on. On launch my app needs to determine whether or not it should show onboarding UI based on a few conditions. While my app is making this determination, I overlay a separate UIWindow in the UIWindowScene that shows a UIActivityIndicatorView. Then if I do in fact have to show the onboarding UI, this overlayed window shows the onboarding view controller by presenting it modally. Underneath this overlayed window is my standard UIWindow. In that window hierarchy underneath there is a UINavigationController with navigation bar. It appears UIKit on macOS draws this separator line underneath the navigation bar when the window is in certain states...but the separator is bleeding through from the UIWindow that's offscreen. That UIWindow should be completely offscreen while the overlay window is the key window (and it is, except for the line separator bleeding through and causing this glitch). So if I do this: #if TARGET_OS_MACCATALYST     [self setNavigationBarHidden:YES animated:NO];     #endif The line separator issue goes away.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location
The separator snaps into place after I resize the window....anyway I can programmatically force the window to relayout the separator? The request geometry update method isn't released yet (I guess it will be released when iPadOS 16 comes out?)
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’22