我找到了答案。
正确的方法是在你的 MYWindow 中实现这些方法:NSWindow
BOOL needsEnableUpdate;
-(void)disableUpdatesUntilFlush
{
if(!needsEnableUpdate)
NSDisableScreenUpdates();
needsEnableUpdate = YES;
}
-(void)flushWindow
{
[super flushWindow];
if(needsEnableUpdate)
{
needsEnableUpdate = NO;
NSEnableScreenUpdates();
}
}
并在 NSSplitterView 委托中实现
#pragma mark NSSplitView Delegate
-(void)splitViewWillResizeSubviews:(NSNotification *)notification
{
[window disableUpdatesUntilFlush];
}
我的问题是我试图使用碳调用:
DisableScreenUpdates();
EnableScreenUpdates();
而不是可可的:
NSDisableScreenUpdates();
NSEnableScreenUpdates();