實例方法
image
imageScale(_:)
根據可用的相對大小之一縮放視圖中的圖像,包括小、中和大圖像大小。
聲明
func imageScale(_ scale: Image.Scale) -> some View
參數
scale
圖像比例枚舉提供的相對大小之一。
詳述
下麵的示例顯示了相對縮放效果。係統根據它正在縮放的圖像的可用空間和配置選項以相對大小呈現圖像。
VStack {
HStack {
Image(systemName: "heart.fill")
.imageScale(.small)
Text("Small")
}
HStack {
Image(systemName: "heart.fill")
.imageScale(.medium)
Text("Medium")
}
HStack {
Image(systemName: "heart.fill")
.imageScale(.large)
Text("Large")
}
}
可用版本
iOS 13.0+, iPadOS 13.0+, macOS 11.0+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+
相關用法
- Swift Optional interactiveDismissDisabled(_:)用法及代碼示例
- Swift Optional init(nilLiteral:)用法及代碼示例
- Swift Optional symbolVariant(_:)用法及代碼示例
- Swift Optional popover(isPresented:attachmentAnchor:arrowEdge:content:)用法及代碼示例
- Swift Optional mask(alignment:_:)用法及代碼示例
- Swift Optional listSectionSeparatorTint(_:edges:)用法及代碼示例
- 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:)用法及代碼示例
- Swift Optional offset(_:)用法及代碼示例
- Swift Optional focused(_:equals:)用法及代碼示例
- Swift Optional hidden()用法及代碼示例
- Swift Optional previewDevice(_:)用法及代碼示例
- Swift Optional keyboardShortcut(_:modifiers:localization:)用法及代碼示例
- Swift Optional accessibilityAction(named:_:)用法及代碼示例
- Swift Optional textSelection(_:)用法及代碼示例
- Swift Optional pageCommand(value:in:step:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Optional imageScale(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。