objective-c - NSSplitView 中的 NSOpenGLView

标签 objective-c cocoa opengl macos-carbon splitter

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

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

所以我有两个问题 - 是否有任何 cocoa 方法来修复分离器 - gl 问题? 如果不是 - 我如何修复 Release模式下的碳链接器错误?

最佳答案

我找到了答案。

正确的方法是在你的 MYWindow 中实现这些方法:NSWindow

BOOL needsEnableUpdate;

-(void)disableUpdatesUntilFlush
{
    if(!needsEnableUpdate)
        NSDisableScreenUpdates();
    needsEnableUpdate = YES;
}

-(void)flushWindow
{
    [super flushWindow];
    if(needsEnableUpdate)
    {
        needsEnableUpdate = NO;
        NSEnableScreenUpdates();
    }
}

并在 NSSplitterView 委托(delegate)中实现

#pragma mark NSSplitView Delegate
-(void)splitViewWillResizeSubviews:(NSNotification *)notification
{
    [window disableUpdatesUntilFlush];
}

我的问题是我尝试使用碳调用:

DisableScreenUpdates();
EnableScreenUpdates();

代替 cocoa :

NSDisableScreenUpdates();
NSEnableScreenUpdates();

关于objective-c - NSSplitView 中的 NSOpenGLView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2686812/

相关文章:

objective-c - NSURL 返回文件的 id 而不是文件的路径

java - JOGL 2.0 和过剩

objective-c - 您如何确定具有很多属性的对象(self)是否已被更改?

ios - UIAlertView 当没有按钮按下时计数 10 秒并执行某些操作

cocoa - NSScrollview 自动布局问题

c++ - 正确实现纹理图集

C、打开gl,绘制直到另一行

ios - 将 UIImage 扭曲成平行四边形

objective-c - objective-c :图像未正确显示在UIBarButtonItem中

cocoa - 用于 IPAD 和 http post 查询到服务器的 Erply Inventory API 开发