0

我试图将自定义工具栏添加到我的应用程序中。为了在窗口底部找到它,我又创建了一个窗口并将工具栏添加到其中:

var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
    contentView = [theWindow contentView],
    bounds = [contentView bounds];
[contentView setBackgroundColor:[CPColor colorWithHexString:@"cecece"]];

///second window to place the toolbar at the bottom
var w2 = [[CPPanel alloc] initWithContentRect:CGRectMake(0, CGRectGetHeight(bounds) - _settings.toolbarSize,
                                                          CGRectGetWidth(bounds), _settings.toolbarSize)
                           styleMask: CPBorderlessWindowMask]
var c2 = [w2 contentView]
[c2 setBackgroundColor:[CPColor colorWithHexString:@"ff0000"]];

///a toolbar
toolbar = [[Toolbar alloc] initWithWindow:w2];

///show window
[theWindow orderFront:self];
[w2 orderFront:self];

它适用于 Cappuccino 0.8.1,但不适用于最新版本。仅当我为它设置工具栏或使用它theWindow初始化时,它才会根据需要呈现。w2CPBorderlessBridgeWindowMask

有谁知道这种行为的原因是什么?

4

0 回答 0