【问题标题】:NSOpenGLView in NSSplitViewNSSplitView 中的 NSOpenGLView
【发布时间】:2010-04-21 21:48:25
【问题描述】:

当我将 NSOpenglView 放入 NSSplitView 时,拖动拆分器时出现问题。 openGLView 和 SplitView 正在异步调整大小。我在苹果邮件列表线程http://developer.apple.com/mac/library/samplecode/GLChildWindowDemo/Introduction/Intro.html中找到了一个解决方案@

我找到了一些碳调用的解决方案。但现在我得到链接错误(仅在发布模式下)。

所以我有两个问题 - 是否有任何可可方法来修复分离器 - gl 问题? 如果没有 - 如何在发布模式下修复碳链接器错误?

【问题讨论】:

  • 可能已弃用的 carbon wrapers 正在发送链接错误。另一方面,我读到 OpenGL 和 UIKit 元素无法正常播放……我建议使用单个框架。
  • 这里没有 UIKit,这是一个 Cocoa/Mac 的问题。

标签: objective-c cocoa opengl macos-carbon splitter


【解决方案1】:

我找到了答案。

正确的方法是在你的 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();

【讨论】:

  • 只是想说谢谢谢谢谢谢。你摇滚。
  • 为了清楚起见,我会写: -(void)disableUpdatesUntilFlush { if(!needsEnableUpdate) { NSDisableScreenUpdates();需要启用更新=是; } }
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多