實例方法
menu
menuIndicator(_:)
設置此視圖中控件的菜單指示器可見性。
聲明
func menuIndicator(_ visibility: Visibility) -> some View
參數
visibility
要應用的菜單指示器可見性。
詳述
使用此修飾符覆蓋此視圖中控件的默認菜單指示器可見性。例如,下麵的代碼創建了一個沒有指示器的菜單:
Menu {
ForEach(history , id: \.self) { historyItem in
Button(historyItem.title) {
self.openURL(historyItem.url)
}
}
} label: {
Label("Back", systemImage: "chevron.backward")
.labelStyle(.iconOnly)
} primaryAction: {
if let last = history.last {
self.openURL(last.url)
}
}
.menuIndicator(.hidden)
可用版本
iOS 15.0+, iPadOS 15.0+, macOS 12.0+, Mac Catalyst 15.0+
相關用法
- Swift Never menuStyle(_:)用法及代碼示例
- Swift Never multilineTextAlignment(_:)用法及代碼示例
- Swift Never monospacedDigit()用法及代碼示例
- Swift Never modifier(_:)用法及代碼示例
- Swift Never minimumScaleFactor(_:)用法及代碼示例
- Swift Never mask(alignment:_:)用法及代碼示例
- Swift Never pageCommand(value:in:step:)用法及代碼示例
- Swift Never opacity(_:)用法及代碼示例
- Swift Never colorMultiply(_:)用法及代碼示例
- Swift Never accessibilityAction(action:label:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:message:)用法及代碼示例
- Swift Never confirmationDialog(_:isPresented:titleVisibility:actions:)用法及代碼示例
- Swift Never flipsForRightToLeftLayoutDirection(_:)用法及代碼示例
- Swift Never position(x:y:)用法及代碼示例
- Swift Never position(_:)用法及代碼示例
- Swift Never luminanceToAlpha()用法及代碼示例
- Swift Never accessibilityAction(_:_:)用法及代碼示例
- Swift Never previewDisplayName(_:)用法及代碼示例
- Swift Never badge(_:)用法及代碼示例
- Swift Never progressViewStyle(_:)用法及代碼示例
- Swift Never buttonStyle(_:)用法及代碼示例
- Swift Never popover(isPresented:attachmentAnchor:arrowEdge:content:)用法及代碼示例
- Swift Never projectionEffect(_:)用法及代碼示例
- Swift Never onTapGesture(count:perform:)用法及代碼示例
- Swift Never overlay(_:in:fillStyle:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Never menuIndicator(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。