资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

详解Swift之clipped是什么如何用

clipped()函数介绍

创新互联主要从事网站设计制作、成都网站设计、网页设计、企业做网站、公司建网站等业务。立足成都服务中牟,十余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575

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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。


新闻标题:详解Swift之clipped是什么如何用
文章地址:http://cdkjz.cn/article/ijjgjp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220