Maverick问题:在NSView上添加子视图时 [英] Maverick Issue : While adding a subview on NSView
问题描述
我有一个NSView(outlet-detailsView),然后是NSSplitView(outlet-detailsSpiltView),在拆分视图中有两个子视图,在那些子视图中有不同的滚动视图和表视图。
I have a NSView(outlet - detailsView) , upon that a NSSplitView (outlet - detailsSpiltView) and there are two subviews in the split view and in those subview there are different scroll view and table view.
NSView(detailsView)
|
NSSplitView(detailsSplitView)
| |
NSView NSView
| |
NSScrollView NSScrollView
| |
NSTableView NSTableVIew
在特定条件下,我会在detailsView和以下添加错误视图在其他情况下,将填充表视图:
加载errorView的代码如下:
On a certain condition I am adding a an error view on detailsView and on other conditions the table view would be populated: The code for loading errorView is the following:
[self.errorView setFrame:[self.detailsSplitView frame]];
[self.errorView setBackgroundColor:ERR_BG_COLOR];
[self.errorView setAlphaValue:0.85];
[self.detailsView addSubview:self.errorView];
在Mountain Lion中可以正常使用,但在Maverick中,errorView会加载到表视图的后面。
我什至尝试使用代码向后发送表视图
Its working perfectly in Mountain Lion but in Maverick the errorView is getting loaded behind the table views. I even tried to send the table views in back using code
[tableView1 sendToBack];
[tableView2 sendToBack];
[self.detailsView addSubview:self.errorView positioned:NSWindowAbove relativeTo:self.detailsSplitView];
但仍然在表视图的后面加载错误视图。
But still errorview is loading in the back of tableview.
推荐答案
我在addSubView方法下面添加了以下代码,并且可以正常工作:
I added the following code beneath the addSubView method and it worked:
--------
[self.detailsView addSubview:self.errorView];
[self.errorView setWantsLayer:YES];
这篇关于Maverick问题:在NSView上添加子视图时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!