CPToolbar仅在CPBorderlessBridgeWindowMask窗口中呈现

时间:2014-10-15 22:27:59

标签: cappuccino objective-j

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

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设置工具栏或使用w2设置初始CPBorderlessBridgeWindowMask时,才会根据需要进行渲染。

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

0 个答案:

没有答案