Clips the view to its bounding rectangular frame.將View裁剪成矩形框架
By default, a view’s bounding frame is used only for layout, so any content that extends beyond the edges of the frame is still visible. Use the clipped(antialiased:)modifier to hide any content that extends beyond these edges.ide
默認狀況下,視圖的邊界框架僅用於佈局,所以超出框架邊緣的任何內容仍然可見。使用clipped(antialiased:)修飾器能夠隱藏超出這些邊緣的任何內容。函數
import SwiftUI struct ProductCard: View { var body: some View { VStack(alignment:.leading,spacing: 0){ Image("circle") .resizable() .scaledToFit() .frame(minWidth:nil, idealWidth: nil, maxWidth: UIScreen.main.bounds.width, minHeight: nil, idealHeight: nil, maxHeight: 300, alignment: .center ) .clipped() } } }