2

我正在使用 NSViewController 来加载一个带有呈现核心绘图图表的视图的笔尖。我使用以下代码替换“目标视图”:

NSViewController* aViewController = [[NSViewController alloc] initWithNibName:@"nib name" bundle:nil];
if (aViewController != nil)
{
    myCurrentViewController = aViewController;
}

// embed the current view to our host view
[myTargetView addSubview: [myCurrentViewController view]];
[[myCurrentViewController view] setFrame: [myTargetView bounds]];

这导致图表中的所有内容基本上看起来都有些模糊。我注释掉了 setFrame 并尝试了 setFrame 的整数值,但没有任何区别。目标视图也没有分层。

如果我摆脱视图控制器并将 myTargetView 更改为实际的图表视图类(PlotView),那么它不再是模糊的。这是10.8。知道为什么使用 NSViewController 路由会弄乱图表视图吗?

更新 #1:我使用 Plot_Gallery_Mac 示例项目中的 PlotGalleryController、PlotView、PlotItem 和 VerticalBarChart 通过 NSViewController 生成图表。我猜测示例 PlotItem 类中的设置(特别是 renderInView 方法)与将其与 NSViewController 一起使用不兼容。

4

0 回答 0