Re: Correcting scrollbar after app state restoration

Glenn L. Austin

You need to save and restore the state of the data being shown as well.  If you use an IndexSet for your sub-collection, you could use, save and restore that.

Glenn L. Austin, Computer Wizard and Race Car Driver         <><

On May 13, 2020, at 9:00 PM, Steve Mills via <sjmills@...> wrote:

I've noticed that the vertical scrollbar in the scroll view for my collection view is wrong after app restoration. This happens if the full collection (via CoreData) has, say 1000 items in it, then I do a filtered fetch to limit the collection to, say, 100 items. When showing all 1k items, the scrollbar thumb is small. When showing 100 items, the thumb is much larger.

I save and quit. The next time I launch, it restores the previously opened doc and restores the window state, including the collection view, scroll view, and scrollbar, including restoring the scrollbar state, which means the thumb is large like it was during save and quit, yet the collection view contains all 1k items, not just 100 items.

I can *not* figure out a good way to tell the collection view, scroll view, or what that it needs to recalc the size of the thumb. It's driving me bonkers. Any ideas?

All the restoration crap is just being handled by the OS - I'm not overriding any method to do the state restoration.

Steve Mills
Drummer, Mac geek

Join to automatically receive all group messages.