问题
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
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];
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.
回答1:
I added the following code beneath the addSubView method and it worked:
--------
[self.detailsView addSubview:self.errorView];
[self.errorView setWantsLayer:YES];
来源:https://stackoverflow.com/questions/20113498/maverick-issue-while-adding-a-subview-on-nsview