實例方法
rotation
rotationEffect(_:anchor:)
圍繞指定點旋轉此視圖的渲染輸出。
聲明
func rotationEffect(
_ angle: Angle,
anchor: UnitPoint = .center
) -> some View
參數
angle
旋轉視圖的角度。
anchor
默認值為
UnitPoint/center
的位置,用於定義旋轉錨定點。
詳述
使用rotationEffect(_:anchor:)
將視圖旋轉特定量。
在下麵的示例中,文本旋轉了 22˚。
Text("Rotation by passing an angle in degrees")
.rotationEffect(.degrees(22))
.border(Color.gray)
可用版本
iOS 13.0+, iPadOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+
相關用法
- Swift Optional rotation3DEffect(_:axis:anchor:anchorZ:perspective:)用法及代碼示例
- Swift Optional refreshable(action:)用法及代碼示例
- 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 imageScale(_:)用法及代碼示例
- Swift Optional accessibilityAction(named:_:)用法及代碼示例
- Swift Optional textSelection(_:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Optional rotationEffect(_:anchor:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。