Post

Replies

Boosts

Views

Activity

Reply to Mac Catalyst Crash on App Launch on macOS 26.1: Assertion failure in -[NSToolbarItemGroupView _layoutWrapperViewsWithAttributes:], NSToolbarItemGroupView.m:599
Also I lose the ability to set the itemIdentifier property on subitems when creating the NSToolbarItemGroup with the class constructor. Presumably the subitem is still the sender when NSToolbarItem invokes its action? Being able to define itemIdentifier on subitem can sometimes be useful. I guess I can use tag instead but feels like a lot of busy work here. Err
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’25
Reply to Mac Catalyst Crash on App Launch on macOS 26.1: Assertion failure in -[NSToolbarItemGroupView _layoutWrapperViewsWithAttributes:], NSToolbarItemGroupView.m:599
Ya using +groupWithItemIdentifier:images:selectionMode:labels:target:action: avoids the crash. So under this API design am I permitted to do this? NSToolbarItemGroup *readStatusToolbarGroup = [NSToolbarItemGroup groupWithItemIdentifier:itemIdentifier images:@[mailOpenEnvelopeImage, mailBadgedEnvelopeImage] selectionMode:NSToolbarItemGroupSelectionModeSelectOne labels:@[@"Read",@"Unread"] target:nil action:nil]; NSUInteger i = 0; for (NSToolbarItem *aItem in readStatusToolbarGroup.subitems) { if (i == 0) { aItem.action = @selector(markRead:); aItem.toolTip = @"Tooltip for this one.."; } else if (i == 1) { aItem.action = @selector(markUnread:); aItem.toolTip = @"Tooltip for this one..."; } i++; } This API design is not very good TBH. I'm not really happy about having to rewrite the code to build four toolbar groups (I already did this work). I'd like to move forward instead of running in place all the time. BTW the appearance of the toolbar groups don't look particularly special when created via the group class constructor so I dk what's with all the system appearance talk. It isn't clear to me why the underlying implementation can't build the toolbar properly in the same way from -setSubItems: These toolbar items just get images and titles I'm not even using a custom view for the toolbar item.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’25
Reply to .hidden not working when making UIBarButtonItem visibles on iOS 26
This is still a thing. I have a UIToolbar with some buttons in it. They are are created in Interface Builder. One is hidden. At runtime, something happens and I set hidden = NO to show that one button that is hidden and nothing happens. I see UIToolbar is now a wrapper on top of SwiftUI on iOS 26 so while this is disappointing this type of bug isn't really shocking. @N. Holzschuch Thanks for sharing. Setting the items like it's iOS 15.0 does the trick. I tried just resetting the property with a copy of the .items array but it didn't work. Adding a dummy bar button item then removing it seems to be required.
Topic: UI Frameworks SubTopic: General
Nov ’25
Reply to Spotlight Shows "Helper Apps" That Are Inside Main App Bundle That Are Not Intended to Be Launched By The User
Okay so I moved the path to Contents/Helpers. I tested in a Virtual Machine (though not a complete fresh one) but it seems the services for the app in Contents/Helpers are indeed discoverable. So over the last 8 years I either misremembered my reason for choosing Contents/Applications/ or I made a mistake or this was an issue that was resolved during that time. In any case I think the complete answer is: Use Contents/Helpers instead of Contents/Applications to get the app out of the Spotlight app launcher on Tahoe. Thanks for your help
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSScrollView scrolling hitch
You can quite easily see NSScrollView jitter/stall if you open a Finder window -> Icon view -> Use Groups -> yes. Make sure the folder you are viewing has a few collapsable sections. Collapse some of them. Then start vertically scrolling top to bottom. Scrolling will get interrupted often when the cursor moves over the collapsed sections. The scrollbar will freeze visible until you click somewhere and then the scrolling animation will start. You might think the horizontal scrolling of the collapsed section is colliding with the vertical scrolling and that that is causing the stutter but that's not what's happening. In my testing I can just stick a subview partially outside the bounds of the document view (but not increase the width of the document view so horizontal scrolling is not enabled) and the same stutter occurs. I went back to macOS Monterey and tried to reproduce but could not. Not sure when this bug came about. But adjusting the scroll point in a -scrollWheel: override without calling super avoids the issue and scrolling seems much more responsive. I think just calling -scrollPoint: kicks off Core Animation implicit animations(?) they seem to do a good enough job.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to Spotlight Shows "Helper Apps" That Are Inside Main App Bundle That Are Not Intended to Be Launched By The User
I could be remembering wrong and maybe just switching the path would resolve but is Spotlight indexing required to get the .app's NSServices to appear in the Services menu? Sorry for the double reply and the re-ask, but I was still wondering about this. I am planning on changing the Path to Contents/Helpers and testing in a virtual environment in case there is any caching etc. as it related to Services to see if it works. These helper apps need their Services to be discovered by the system and is core to their functionality so if that somehow requires Spotlight indexing or being registered with Launch services or whatever I can't change the path. If you have any knowledge about this that could save me some time so I don't go on a wild goose chase that would be awesome. I could be misremembering all this because of the amount of time that has passed since I set all this up but I think I changed the path to "/Contents/Applications/" because I otherwise couldn't get the Services to show up. If Services are expected to be discovered for helper apps in Contents/Helpers/ then I'll go ahead and try moving them but if you already know that that's just not going to work for my use case that would be great to know ahead of time.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSButton + TtGC6AppKit18_NSCoreHostingViewVS_12AppKitButton - Image Alignment Changed/Broken in Minor macOS 26.1 Update
So I had to pepper a few of these around: // NSButton image scaling changed in 26.1 with certain SF symbols? if (@available(macOS 26.1, *)) { // looks better on 26.1 button.imageScaling = NSImageScaleProportionallyDown; } else { // looks better on 26.0. button.imageScaling = NSImageScaleProportionallyUpOrDown; } And one of these for a symbol image... NSImageSymbolScale symbolScale; if (@available(macOS 26.1, *)) { // large is too big on on 26.1 so let's go down to medium symbolScale = NSImageSymbolScaleMedium; } else { // need large on 26.0 symbolScale = NSImageSymbolScaleLarge; } NSImage *symbol = // make image with symbolScale and use it in a NSButton
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
Reply to NSScrollView scrolling hitch
I just ran into an issue where NSScrollView got stuck mid scroll. I answered in another thread here: https://developer.apple.com/forums/thread/748826?answerId=865833022#865833022 My simple override of scrollWheel: fixed the issue for me but I do lose the "rubber band" bounce back effect shouldn't be too hard to implement it but I'd rather not right now. I'll give up the rubber band bounce back in exchange for having a scroll view that doesn't freeze mid-scroll. I tried overriding +isCompatibleWithResponsiveScrolling and returning NO but it was never called on my NSScrollView subclass for some reason.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSScrollView two finger drag being interrupted
I'm not sure if our issues are exactly the same but in my case when scrolling gets stuck the scroll bar also remains visible like it's paused until I mouse click and the scroll position jumps for all the skipped frames. I dk if they are pausing a private CADisplayLink or something erroneously. Something not nice is going on with NSScrollView here! A subview sticking out partially on a horizontal edge slightly seems to trigger it for me. So regardless of whether or not I have subviews sticking out on the right or left edge of the scroll view it seems I can achieve "butter vertical scrolling" simply by overriding -scrollWheel: in the 'document view' subclass and moving the scroll point myself without calling super.... -(void)scrollWheel:(NSEvent*)event { CGFloat deltaY = (event.hasPreciseScrollingDeltas) ? event.scrollingDeltaY : event.scrollingDeltaY * self.enclosingScrollView.verticalLineScroll; NSRect currentVisibleRect = self.visibleRect; CGPoint scrollPoint = currentVisibleRect.origin; scrollPoint.y = scrollPoint.y - deltaY; [self scrollPoint:scrollPoint]; } I wish I didn't spend half a day on this!!!!
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSScrollView two finger drag being interrupted
so it looks like if one subview of the document view extends past its NSMaxX(self.bounds) even partially two finger drag scrolling can stutter when scrolling is initiated from around this area of the scroll view. I don't want to widen the document view because I actually don't want horizontal scrolling in this case
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSScrollView two finger drag being interrupted
Did you ever find a solution to this? I'm running into an issue where two finger scrolling on a Magic Trackpad can occasionally be interrupted. In my case the documentView is only scrollable vertically. But there is a situation (intentionally) where some subviews of the document view are positioned outside of the visible region on the x-axis (say extended a bit beyond NSMaxX of the visibleRect or before before NSMinX, not too many views though). We can call this a "row" of subviews. When the mouse is hovered over this row on the Y-axis (with the views off screen) when vertical scrolling first starts scrolling can be interrupted. I tried all sorts of things like setting clipsToBounds YES on the a bunch parent views and even the document view itself thinking drawing outside the visible area has something to do with this laggy scroll. This only occurs with two finger drag on a Magic Trackpad (not sure about Magic Mouse because I don't have one) but I have a non-Apple scroll wheel mouse and vertical scrolling never seems to be interrupted. At first I though my -scrollWheel override did it so I took it out and it but the problem still occurs.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSCollectionLayoutBoundarySupplementaryItem background blur covering the entire layout section
Fixing the header view frames like this seems to work. NSSet <NSIndexPath*> *theIndexPaths = [collectionView indexPathsForVisibleSupplementaryElementsOfKind:NSCollectionElementKindSectionHeader]; for (NSIndexPath *aIndexPath in theIndexPaths) { NSView *headerView = [collectionView supplementaryViewForElementKind:NSCollectionElementKindSectionHeader atIndexPath:aIndexPath]; NSView *headerViewSuperview = headerView.superview; NSCollectionViewLayoutAttributes *headerLayoutAttributes = [collectionView layoutAttributesForSupplementaryElementOfKind:NSCollectionElementKindSectionHeader atIndexPath:aIndexPath]; if (headerView != nil && headerViewSuperview != nil && headerLayoutAttributes != nil) { NSRect headerViewRect = headerView.frame; NSRect targetRect = [headerViewSuperview convertRect:headerLayoutAttributes.frame fromView:collectionView]; if (!NSEqualRects(targetRect, headerViewRect)) { headerView.frame = targetRect; } else { // frame okay } } else { os_log_fault(OS_LOG_DEFAULT, "Header view in visible region not properly set up."); } } I'll probably wrap it in a category method
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSCollectionLayoutBoundarySupplementaryItem background blur covering the entire layout section
For me I had better success just calling -performBatchUpdates:completionHandler: with a nil updates block. Maybe scratch that. I'm able to restore scroll position properly after a previous reloadData call in the completionHandler: the but sometimes header views are still misplaced. After inspecting index paths for visible items and index paths for header view etc. it seems that these index path collections are completely out of whack and are nowhere near the visible collection view region. Appears there is some kind of bug in NSCollectionView where visible index paths and visible header views are not updated to match the visible region. Seems to occur when the collection view is updated/scrolled ~viewDidAppear so I'm probably experiencing the same bug when it comes to the header views not be properly shown. Also was surprised to discover that there are some situations where NSCollectionView won't call the completion block with -performBatchUpdates:completionHandler: so whatever code you put in there could potentially get dropped (shouldn't it always call the completion block and pass NO for the finished flag?). I might just umm stay away from that...
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to NSCollectionLayoutBoundarySupplementaryItem background blur covering the entire layout section
But still when transitioning back with my NSPageController to the collection view the pinned header is hidden until the transition completes but I was able to mitigate that issue by calling invalidateLayout() briefly after the navigation starts. I noticed a similar issue - headers are sometimes misplaced when they are shown for the first time (headers can be toggled in my app). I'm actually using the old flow layout still so it may be a different issue but the headers snap in place after scrolling a bit. In my case calls to invalidateLayout etc. didn't reliably help. Fixing stuff after performSelector: afterDelay worked but is ugly and I want to avoid. For me I had better success just calling -performBatchUpdates:completionHandler: with a nil updates block. My original plan was to try to fix the frames in the completionHandler which ought to be called after layout is actually ready but simply calling performBatchUpdates:completionHandler: and doing nothing seems to kick it in gear. I guess I'll have to test more to be sure though. I also use the -performBatchUpdates:completionHandler: with the nil updates block to do things like restoring scroll position which you can only do when the layout is ready.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’25
Reply to Mac Catalyst Crash on App Launch on macOS 26.1: Assertion failure in -[NSToolbarItemGroupView _layoutWrapperViewsWithAttributes:], NSToolbarItemGroupView.m:599
Also I lose the ability to set the itemIdentifier property on subitems when creating the NSToolbarItemGroup with the class constructor. Presumably the subitem is still the sender when NSToolbarItem invokes its action? Being able to define itemIdentifier on subitem can sometimes be useful. I guess I can use tag instead but feels like a lot of busy work here. Err
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to Mac Catalyst Crash on App Launch on macOS 26.1: Assertion failure in -[NSToolbarItemGroupView _layoutWrapperViewsWithAttributes:], NSToolbarItemGroupView.m:599
Ya using +groupWithItemIdentifier:images:selectionMode:labels:target:action: avoids the crash. So under this API design am I permitted to do this? NSToolbarItemGroup *readStatusToolbarGroup = [NSToolbarItemGroup groupWithItemIdentifier:itemIdentifier images:@[mailOpenEnvelopeImage, mailBadgedEnvelopeImage] selectionMode:NSToolbarItemGroupSelectionModeSelectOne labels:@[@"Read",@"Unread"] target:nil action:nil]; NSUInteger i = 0; for (NSToolbarItem *aItem in readStatusToolbarGroup.subitems) { if (i == 0) { aItem.action = @selector(markRead:); aItem.toolTip = @"Tooltip for this one.."; } else if (i == 1) { aItem.action = @selector(markUnread:); aItem.toolTip = @"Tooltip for this one..."; } i++; } This API design is not very good TBH. I'm not really happy about having to rewrite the code to build four toolbar groups (I already did this work). I'd like to move forward instead of running in place all the time. BTW the appearance of the toolbar groups don't look particularly special when created via the group class constructor so I dk what's with all the system appearance talk. It isn't clear to me why the underlying implementation can't build the toolbar properly in the same way from -setSubItems: These toolbar items just get images and titles I'm not even using a custom view for the toolbar item.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to .hidden not working when making UIBarButtonItem visibles on iOS 26
This is still a thing. I have a UIToolbar with some buttons in it. They are are created in Interface Builder. One is hidden. At runtime, something happens and I set hidden = NO to show that one button that is hidden and nothing happens. I see UIToolbar is now a wrapper on top of SwiftUI on iOS 26 so while this is disappointing this type of bug isn't really shocking. @N. Holzschuch Thanks for sharing. Setting the items like it's iOS 15.0 does the trick. I tried just resetting the property with a copy of the .items array but it didn't work. Adding a dummy bar button item then removing it seems to be required.
Topic: UI Frameworks SubTopic: General
Replies
Boosts
Views
Activity
Nov ’25
Reply to Spotlight Shows "Helper Apps" That Are Inside Main App Bundle That Are Not Intended to Be Launched By The User
Okay so I moved the path to Contents/Helpers. I tested in a Virtual Machine (though not a complete fresh one) but it seems the services for the app in Contents/Helpers are indeed discoverable. So over the last 8 years I either misremembered my reason for choosing Contents/Applications/ or I made a mistake or this was an issue that was resolved during that time. In any case I think the complete answer is: Use Contents/Helpers instead of Contents/Applications to get the app out of the Spotlight app launcher on Tahoe. Thanks for your help
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSScrollView scrolling hitch
You can quite easily see NSScrollView jitter/stall if you open a Finder window -> Icon view -> Use Groups -> yes. Make sure the folder you are viewing has a few collapsable sections. Collapse some of them. Then start vertically scrolling top to bottom. Scrolling will get interrupted often when the cursor moves over the collapsed sections. The scrollbar will freeze visible until you click somewhere and then the scrolling animation will start. You might think the horizontal scrolling of the collapsed section is colliding with the vertical scrolling and that that is causing the stutter but that's not what's happening. In my testing I can just stick a subview partially outside the bounds of the document view (but not increase the width of the document view so horizontal scrolling is not enabled) and the same stutter occurs. I went back to macOS Monterey and tried to reproduce but could not. Not sure when this bug came about. But adjusting the scroll point in a -scrollWheel: override without calling super avoids the issue and scrolling seems much more responsive. I think just calling -scrollPoint: kicks off Core Animation implicit animations(?) they seem to do a good enough job.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to Spotlight Shows "Helper Apps" That Are Inside Main App Bundle That Are Not Intended to Be Launched By The User
I could be remembering wrong and maybe just switching the path would resolve but is Spotlight indexing required to get the .app's NSServices to appear in the Services menu? Sorry for the double reply and the re-ask, but I was still wondering about this. I am planning on changing the Path to Contents/Helpers and testing in a virtual environment in case there is any caching etc. as it related to Services to see if it works. These helper apps need their Services to be discovered by the system and is core to their functionality so if that somehow requires Spotlight indexing or being registered with Launch services or whatever I can't change the path. If you have any knowledge about this that could save me some time so I don't go on a wild goose chase that would be awesome. I could be misremembering all this because of the amount of time that has passed since I set all this up but I think I changed the path to "/Contents/Applications/" because I otherwise couldn't get the Services to show up. If Services are expected to be discovered for helper apps in Contents/Helpers/ then I'll go ahead and try moving them but if you already know that that's just not going to work for my use case that would be great to know ahead of time.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSButton + TtGC6AppKit18_NSCoreHostingViewVS_12AppKitButton - Image Alignment Changed/Broken in Minor macOS 26.1 Update
So I had to pepper a few of these around: // NSButton image scaling changed in 26.1 with certain SF symbols? if (@available(macOS 26.1, *)) { // looks better on 26.1 button.imageScaling = NSImageScaleProportionallyDown; } else { // looks better on 26.0. button.imageScaling = NSImageScaleProportionallyUpOrDown; } And one of these for a symbol image... NSImageSymbolScale symbolScale; if (@available(macOS 26.1, *)) { // large is too big on on 26.1 so let's go down to medium symbolScale = NSImageSymbolScaleMedium; } else { // need large on 26.0 symbolScale = NSImageSymbolScaleLarge; } NSImage *symbol = // make image with symbolScale and use it in a NSButton
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSScrollView scrolling hitch
I filed: FB21013306
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSScrollView scrolling hitch
I just ran into an issue where NSScrollView got stuck mid scroll. I answered in another thread here: https://developer.apple.com/forums/thread/748826?answerId=865833022#865833022 My simple override of scrollWheel: fixed the issue for me but I do lose the "rubber band" bounce back effect shouldn't be too hard to implement it but I'd rather not right now. I'll give up the rubber band bounce back in exchange for having a scroll view that doesn't freeze mid-scroll. I tried overriding +isCompatibleWithResponsiveScrolling and returning NO but it was never called on my NSScrollView subclass for some reason.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSScrollView two finger drag being interrupted
I'm not sure if our issues are exactly the same but in my case when scrolling gets stuck the scroll bar also remains visible like it's paused until I mouse click and the scroll position jumps for all the skipped frames. I dk if they are pausing a private CADisplayLink or something erroneously. Something not nice is going on with NSScrollView here! A subview sticking out partially on a horizontal edge slightly seems to trigger it for me. So regardless of whether or not I have subviews sticking out on the right or left edge of the scroll view it seems I can achieve "butter vertical scrolling" simply by overriding -scrollWheel: in the 'document view' subclass and moving the scroll point myself without calling super.... -(void)scrollWheel:(NSEvent*)event { CGFloat deltaY = (event.hasPreciseScrollingDeltas) ? event.scrollingDeltaY : event.scrollingDeltaY * self.enclosingScrollView.verticalLineScroll; NSRect currentVisibleRect = self.visibleRect; CGPoint scrollPoint = currentVisibleRect.origin; scrollPoint.y = scrollPoint.y - deltaY; [self scrollPoint:scrollPoint]; } I wish I didn't spend half a day on this!!!!
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSScrollView two finger drag being interrupted
so it looks like if one subview of the document view extends past its NSMaxX(self.bounds) even partially two finger drag scrolling can stutter when scrolling is initiated from around this area of the scroll view. I don't want to widen the document view because I actually don't want horizontal scrolling in this case
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSScrollView two finger drag being interrupted
Did you ever find a solution to this? I'm running into an issue where two finger scrolling on a Magic Trackpad can occasionally be interrupted. In my case the documentView is only scrollable vertically. But there is a situation (intentionally) where some subviews of the document view are positioned outside of the visible region on the x-axis (say extended a bit beyond NSMaxX of the visibleRect or before before NSMinX, not too many views though). We can call this a "row" of subviews. When the mouse is hovered over this row on the Y-axis (with the views off screen) when vertical scrolling first starts scrolling can be interrupted. I tried all sorts of things like setting clipsToBounds YES on the a bunch parent views and even the document view itself thinking drawing outside the visible area has something to do with this laggy scroll. This only occurs with two finger drag on a Magic Trackpad (not sure about Magic Mouse because I don't have one) but I have a non-Apple scroll wheel mouse and vertical scrolling never seems to be interrupted. At first I though my -scrollWheel override did it so I took it out and it but the problem still occurs.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSCollectionLayoutBoundarySupplementaryItem background blur covering the entire layout section
Fixing the header view frames like this seems to work. NSSet <NSIndexPath*> *theIndexPaths = [collectionView indexPathsForVisibleSupplementaryElementsOfKind:NSCollectionElementKindSectionHeader]; for (NSIndexPath *aIndexPath in theIndexPaths) { NSView *headerView = [collectionView supplementaryViewForElementKind:NSCollectionElementKindSectionHeader atIndexPath:aIndexPath]; NSView *headerViewSuperview = headerView.superview; NSCollectionViewLayoutAttributes *headerLayoutAttributes = [collectionView layoutAttributesForSupplementaryElementOfKind:NSCollectionElementKindSectionHeader atIndexPath:aIndexPath]; if (headerView != nil && headerViewSuperview != nil && headerLayoutAttributes != nil) { NSRect headerViewRect = headerView.frame; NSRect targetRect = [headerViewSuperview convertRect:headerLayoutAttributes.frame fromView:collectionView]; if (!NSEqualRects(targetRect, headerViewRect)) { headerView.frame = targetRect; } else { // frame okay } } else { os_log_fault(OS_LOG_DEFAULT, "Header view in visible region not properly set up."); } } I'll probably wrap it in a category method
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSCollectionLayoutBoundarySupplementaryItem background blur covering the entire layout section
For me I had better success just calling -performBatchUpdates:completionHandler: with a nil updates block. Maybe scratch that. I'm able to restore scroll position properly after a previous reloadData call in the completionHandler: the but sometimes header views are still misplaced. After inspecting index paths for visible items and index paths for header view etc. it seems that these index path collections are completely out of whack and are nowhere near the visible collection view region. Appears there is some kind of bug in NSCollectionView where visible index paths and visible header views are not updated to match the visible region. Seems to occur when the collection view is updated/scrolled ~viewDidAppear so I'm probably experiencing the same bug when it comes to the header views not be properly shown. Also was surprised to discover that there are some situations where NSCollectionView won't call the completion block with -performBatchUpdates:completionHandler: so whatever code you put in there could potentially get dropped (shouldn't it always call the completion block and pass NO for the finished flag?). I might just umm stay away from that...
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSCollectionLayoutBoundarySupplementaryItem background blur covering the entire layout section
But still when transitioning back with my NSPageController to the collection view the pinned header is hidden until the transition completes but I was able to mitigate that issue by calling invalidateLayout() briefly after the navigation starts. I noticed a similar issue - headers are sometimes misplaced when they are shown for the first time (headers can be toggled in my app). I'm actually using the old flow layout still so it may be a different issue but the headers snap in place after scrolling a bit. In my case calls to invalidateLayout etc. didn't reliably help. Fixing stuff after performSelector: afterDelay worked but is ugly and I want to avoid. For me I had better success just calling -performBatchUpdates:completionHandler: with a nil updates block. My original plan was to try to fix the frames in the completionHandler which ought to be called after layout is actually ready but simply calling performBatchUpdates:completionHandler: and doing nothing seems to kick it in gear. I guess I'll have to test more to be sure though. I also use the -performBatchUpdates:completionHandler: with the nil updates block to do things like restoring scroll position which you can only do when the layout is ready.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’25