gpt4 book ai didi

xcode - 如何删除 Big Sur 上的 NSTableView 缩进

转载 作者:行者123 更新时间:2023-12-03 13:59:04 26 4
gpt4 key购买 nike

Big Sur 添加了一个新属性 风格, 默认为自动。即使我将其设置为全宽,我仍然可以看到在 Xcode 12.1 和 12.2 上运行的应用程序之间的差异
这是一个示例应用程序,其中一个简单的单元格将其背景绘制为红色。
enter image description here
在调试界面时,我可以看到边包含表行。这意味着该单元格没有占据该行的整个宽度。
enter image description here
请让我知道是否有办法让单个单元格 View 扩展整个 tableview 宽度。
这是示例应用程序:https://www.dropbox.com/s/zx4qqncllja1sox/test.zip?dl=0

最佳答案

.fullWidth实际上包括行级别的水平填充。
您需要设置 tableView.style = .plain恢复大苏尔之前的外观和感觉。
来自 NSTableView头文件:

@available(macOS 11.0, *)
public enum Style : Int {
// Automatically infers the effectiveStyle from the table view hierarchy.
case automatic = 0

// Edge-to-edge style with standard content padding at the ends of each row. This content padding is constant and independent of intercellSpacing.
case fullWidth = 1

// Inset style with rounded corners selection
case inset = 2

/* The source list style of NSTableView. Setting this style will have the side effect of setting the background color to "source list".
Additionally in NSOutlineView, the following properties may change to get the standard "source list" look: indentationPerLevel, rowHeight and intercellSpacing. After setting the style it is possible to change any of the other properties as required.
In 10.11, if the background color has been changed from the "source list" background color to something else, the table will no longer draw the selection as a source list blur style, and instead will draw a normal selection highlight.
This replaces NSTableViewSelectionHighlightStyleSourceList which is to be deprecated.
*/
case sourceList = 3

// A plain style. No insets, padding or any other kind of decoration applied to the row or its background. The cells are equally spaced in the row using intercellSpacing.width.
case plain = 4
}

关于xcode - 如何删除 Big Sur 上的 NSTableView 缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64791699/

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