NSWindow not drawn until clicked, resized, etc
I have a window with an NSCollectionView created through Interface Builder. There is an NSArrayController that it bound to a CoreData backing store, which is populated at the time of launch by firing an asynchronous request. The binding of the NSCollectionView to the NSArrayController, etc all seem to be in place; however, the window displays and is blank until the window is either clicked, resized, etc to force it to redraw.
Here are some things I've tried without any noticeable changes. (These are in the NSWindowC开发者_如何学Controller class)
1) Use KVO to monitor when the CoreData fetch is finished. At this point I've tried any and all of the following:
[collectionView setNeedsDisplay:YES];
[[self window] setViewsNeedDisplay:YES];
[[self window] flushWindowIfNeeded];
2) Added an NSProgressIndicator, hide the NSCollectionView at launch and then when the load is complete (again through monitoring KVO), I hide the progress indicator and show the collection view.
Anyone have an tips/clues on what I'm doing wrong here?
seems to kick things into gear.
Thanks to a friend who saw a link to this on Twitter, I have a solution. Once my KVO fires adding a call to:
[arrayController fetch:self];
seems to kick things into gear.
精彩评论