gpt4 book ai didi

cocoa - 特立独行问题 : While adding a subview on NSView

转载 作者:行者123 更新时间:2023-12-03 17:53:01 26 4
gpt4 key购买 nike

我有一个 NSView(outlet -detailsView) ,其上有一个 NSSplitView (outlet -detailsS​​piltView) ,分割 View 中有两个 subview ,在这些 subview 中有不同的 ScrollView 和表格 View 。

NSView(detailsView)
|
NSSplitView(detailsSplitView)
| |
NSView NSView
| |
NSScrollView NSScrollView
| |
NSTableView NSTableVIew

在某种情况下,我在detailsView上添加错误 View ,在其他条件下,将填充 TableView :加载errorView的代码如下:

[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 被加载到 TableView 后面。我什至尝试使用代码将表格 View 发送回去

[tableView1 sendToBack];
[tableView2 sendToBack];
[self.detailsView addSubview:self.errorView positioned:NSWindowAbove relativeTo:self.detailsSplitView];

但是 errorview 仍然在 tableview 的后面加载。

最佳答案

我在 addSubView 方法下添加了以下代码并且它起作用了:

--------
[self.detailsView addSubview:self.errorView];
[self.errorView setWantsLayer:YES];

关于cocoa - 特立独行问题 : While adding a subview on NSView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20113498/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com