實例方法
list
listSectionSeparatorTint(_:edges:)
設置與部分關聯的色調顏色。
聲明
func listSectionSeparatorTint(
_ color: Color?,
edges: VerticalEdge.Set = .all
) -> some View
參數
color
用於為部分分隔符著色的顏色,或
nil
以使用當前列表樣式的默認顏色。edges
應用色調的行邊集。列表樣式可能決定不顯示某些分隔符,通常是頂部邊。默認值為
VerticalEdge/Set/all
。
詳述
分隔符可以顯示在一個部分的上方和下方。您可以指定此首選項應應用於哪個邊。
此修飾符表示對包含 List
的偏好。列表樣式是分隔符色調的最終仲裁者。
以下示例顯示了一個簡單的分組列表,其部分分隔符根據 section-specific 數據著色:
List {
ForEach(garage) { garage in
Section(header: Text(garage.location)) {
ForEach(garage.cars) { car in
Text(car.model)
.listRowSeparatorTint(car.brandColor)
}
}
.listSectionSeparatorTint(
garage.cars.last?.brandColor, edges: .bottom)
}
}
.listStyle(.grouped)
要更改行分隔符的可見性和色調顏色,請使用 View/listRowSeparator(_:edges:)
和 View/listRowSeparatorTint(_:edges:)
。要隱藏部分分隔符,請使用 View/listSectionSeparator(_:edges:)
。
可用版本
iOS 15.0+, iPadOS 15.0+, macOS 13.0+ Beta, Mac Catalyst 15.0+
相關用法
- Swift Optional listSectionSeparator(_:edges:)用法及代碼示例
- Swift Optional listRowSeparator(_:edges:)用法及代碼示例
- Swift Optional listRowSeparatorTint(_:edges:)用法及代碼示例
- Swift Optional listRowBackground(_:)用法及代碼示例
- Swift Optional listRowInsets(_:)用法及代碼示例
- Swift Optional lineSpacing(_:)用法及代碼示例
- Swift Optional lineLimit(_:)用法及代碼示例
- Swift Optional luminanceToAlpha()用法及代碼示例
- Swift Optional labelsHidden()用法及代碼示例
- Swift Optional labelStyle(_:)用法及代碼示例
- Swift Optional layoutPriority(_:)用法及代碼示例
- Swift Optional symbolVariant(_:)用法及代碼示例
- Swift Optional popover(isPresented:attachmentAnchor:arrowEdge:content:)用法及代碼示例
- Swift Optional mask(alignment:_:)用法及代碼示例
- Swift Optional badge(_:)用法及代碼示例
- Swift Optional fullScreenCover(isPresented:onDismiss:content:)用法及代碼示例
- Swift Optional keyboardType(_:)用法及代碼示例
- Swift Optional clipShape(_:style:)用法及代碼示例
- Swift Optional preferredColorScheme(_:)用法及代碼示例
- Swift Optional background(_:ignoresSafeAreaEdges:)用法及代碼示例
- Swift Optional saturation(_:)用法及代碼示例
- Swift Optional focusSection()用法及代碼示例
- Swift Optional overlay(alignment:content:)用法及代碼示例
- Swift Optional colorMultiply(_:)用法及代碼示例
- Swift Optional confirmationDialog(_:isPresented:titleVisibility:presenting:actions:message:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Optional listSectionSeparatorTint(_:edges:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。