實例方法
preview
previewInterfaceOrientation(_:)
覆蓋預覽的方向。
聲明
func previewInterfaceOrientation(_ value: InterfaceOrientation) -> some View
返回值
使用給定方向的預覽。
參數
value
用於預覽的方向。
詳述
默認情況下,設備預覽顯示為正麵朝上,使用方向 InterfaceOrientation/portrait
。您可以使用 InterfaceOrientation
結構中的值之一更改預覽的方向:
struct CircleImage_Previews: PreviewProvider {
static var previews: some View {
CircleImage()
.previewInterfaceOrientation(.landscapeRight)
}
}
可用版本
iOS 15.0+, iPadOS 15.0+, macOS 12.0+, Mac Catalyst 15.0+, tvOS 15.0+, watchOS 8.0+
相關用法
- Swift Never previewDisplayName(_:)用法及代碼示例
- Swift Never previewLayout(_:)用法及代碼示例
- Swift Never previewDevice(_:)用法及代碼示例
- Swift Never preferredColorScheme(_:)用法及代碼示例
- Swift Never prefersDefaultFocus(_:in:)用法及代碼示例
- Swift Never progressViewStyle(_:)用法及代碼示例
- Swift Never projectionEffect(_:)用法及代碼示例
- Swift Never privacySensitive(_:)用法及代碼示例
- Swift Never pageCommand(value:in:step:)用法及代碼示例
- Swift Never position(x:y:)用法及代碼示例
- Swift Never position(_:)用法及代碼示例
- Swift Never popover(isPresented:attachmentAnchor:arrowEdge:content:)用法及代碼示例
- Swift Never padding(_:_:)用法及代碼示例
- Swift Never popover(item:attachmentAnchor:arrowEdge:content:)用法及代碼示例
- Swift Never padding(_:)用法及代碼示例
- 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 luminanceToAlpha()用法及代碼示例
- Swift Never accessibilityAction(_:_:)用法及代碼示例
- Swift Never badge(_:)用法及代碼示例
- Swift Never buttonStyle(_:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Never previewInterfaceOrientation(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。