clipped()函数介绍 Clips the view to its bounding rectangular frame. 将View裁剪成矩形 By default, a
clipped()函数介绍
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.
默认情况下,视图的边界框架仅用于布局,因此超出框架边缘的任何内容仍然可见。使用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()
}
}
}
--结束END--
本文标题: 详解Swift 之clipped是什么如何用
本文链接: https://lsjlt.com/news/30411.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0