新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Swift中clipped如何使用

这篇文章给大家介绍Swift中clipped如何使用,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

成都创新互联公司从2013年创立,先为三明等服务建站,三明等地企业,进行企业商务咨询服务。为三明企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

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 SwiftUIstruct 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()    }  }}

关于Swift中clipped如何使用就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


分享题目:Swift中clipped如何使用
标题来源:http://www.wjwzjz.com/article/jjghee.html
在线咨询
服务热线
服务热线:028-86922220
TOP