NSWindow is not drawn until clicked, resized, etc.

I have a window with an NSCollectionView created through Interface Builder. There is an NSArrayController that is associated with the CoreData backup storage, which is populated at startup by running an asynchronous request. Binding NSCollectionView with NSArrayController etc. Everything seems to be in place; however, the window is displayed and empty until the window is pressed, resized, etc., to force it to be redrawn.

Here are some things I tried without any noticeable changes. (They are in the NSWindowController class)

1) Use KVO to monitor when CoreData sampling is complete. At this point, I tried everything and all of the following:

[collectionView setNeedsDisplay:YES];
[[self window] setViewsNeedDisplay:YES];
[[self window] flushWindowIfNeeded];

2) Added NSProgressIndicator, hide NSCollectionView at startup, and then when the download is complete (again through KVO monitoring), I hide the progress indicator and show the collection view.

Does anyone have any clues / hints about what I'm doing wrong here?

something seems to have floated.

+3
source share
1 answer

Thanks to a friend who saw the link to this on Twitter, I have a solution. As soon as my KVO starts adding a call:

[arrayController fetch:self];

something seems to have floated.

0
source

All Articles