setContentBorderThickness:forEdge 的问题:实际上并未设置该值
我正在尝试使用 setContentBorderThickness:forEdge: 在 Cocoa 应用程序中创建底部栏。
mipadi 发现了一些东西,但在测试它时,我认为这可能是一个稍微不同的问题:
-(void) adjustContentBorderBasedOnArrayControllerSelection{
if(([[self.resultsArrayController selectionIndexes] count] == 0)){
[[self window] setContentBorderThickness:40.0f forEdge:CGRectMinYEdge];
NSLog(@"%f", [[self window] contentBorderThicknessForEdge:CGRectMinYEdge]);
} else {
[[self window] setContentBorderThickness:60.0f forEdge:CGRectMinYEdge];
NSLog(@"%f", [[self window] contentBorderThicknessForEdge:CGRectMinYEdge]);
}
}
即使在我明确设置厚度值之后,这两个 NSLog()
消息也显示厚度值为 0.0。有人知道这是怎么回事吗?
I'm trying to use setContentBorderThickness:forEdge:
to create a bottom bar in a Cocoa application.
mipadi was on to something, but in testing it out, I think maybe this is a slightly different problem:
-(void) adjustContentBorderBasedOnArrayControllerSelection{
if(([[self.resultsArrayController selectionIndexes] count] == 0)){
[[self window] setContentBorderThickness:40.0f forEdge:CGRectMinYEdge];
NSLog(@"%f", [[self window] contentBorderThicknessForEdge:CGRectMinYEdge]);
} else {
[[self window] setContentBorderThickness:60.0f forEdge:CGRectMinYEdge];
NSLog(@"%f", [[self window] contentBorderThicknessForEdge:CGRectMinYEdge]);
}
}
Both of those NSLog()
messages show the thickness value is 0.0 even after I explicitly set it. Anyone know what's up with that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
CGRectMinYEdge
。 (在 64 位系统上,NSMinYEdge
无论如何都会被#define
转换为CGRectMinYEdge
)。You can use
CGRectMinYEdge
. (On 64-bit systems,NSMinYEdge
is#define
'd asCGRectMinYEdge
anyway).您有没有检查过以确保 [self window] 不为零?您的插座设置正确吗?如果没有设置窗口的出口,我就会得到这种行为。
By any chance have you checked to make sure [self window] isn't nil? Do you have your outlet setup right? I get that behavior if the outlet to the window isn't set.