Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
macOS窗口边框大小_Macos_Cocoa_Nswindow - Fatal编程技术网

macOS窗口边框大小

macOS窗口边框大小,macos,cocoa,nswindow,Macos,Cocoa,Nswindow,获取NSWindow边框大小度量的首选方法是什么?基本上,我需要计算出窗口边框的像素厚度 我最近发现自己需要这样做,但各种解决方案似乎已经相当过时了(即碳和HITheme)。基本上,您可以使用这些NSWindow方法之一将内容矩形转换为框架矩形,或反之亦然,然后比较两个矩形: +contentRectForFrameRect:styleMask: +frameRectForContentRect:styleMask: -contentRectForFrameRect: -frameRectFor

获取NSWindow边框大小度量的首选方法是什么?基本上,我需要计算出窗口边框的像素厚度


我最近发现自己需要这样做,但各种解决方案似乎已经相当过时了(即碳和HITheme)。

基本上,您可以使用这些
NSWindow
方法之一将内容矩形转换为框架矩形,或反之亦然,然后比较两个矩形:

+contentRectForFrameRect:styleMask:
+frameRectForContentRect:styleMask:
-contentRectForFrameRect:
-frameRectForContentRect:
如果没有要测量的特定窗口,或者希望忽略工具栏的存在,则可以使用类方法


对于现在的年代,除了顶部(标题栏)之外,窗口上没有任何“边框”。

基本上,您可以使用这些
NSWindow
方法之一将内容矩形转换为框架矩形,或者将内容矩形转换为框架矩形,然后比较两个矩形:

+contentRectForFrameRect:styleMask:
+frameRectForContentRect:styleMask:
-contentRectForFrameRect:
-frameRectForContentRect:
如果没有要测量的特定窗口,或者希望忽略工具栏的存在,则可以使用类方法


很久以来,除了顶部(标题栏),窗口上没有任何“边框”。

非常感谢。我想得太多了。(无边框部分很有意义,因为我在这里移植了一些非常旧的代码。)非常感谢。我想得太多了。(无边框部分很有意义,因为我在这里移植了一些非常古老的代码。)