SwiftUI -3- Image

使用系统图库 SF

Image(systemName: "cloud.heavyrain")
Image(systemName: "cloud.heavyrain")
//系统图片实际上是个字形 所以修改大小需要使用font
    .font(.system(size: 100)) //图片大小
    .foregroundColor(.blue) //图片渲染颜色

自定义图片

Image("paris")

调整大小

.resizable()

忽略安全区

.resizable()
.ignoresSafeArea()

填充模式

.resizable()
.scaledToFit()
// .aspectRatio(contentMode: .fit)
//   .aspectRatio(contentMode: .fill)

修改大小

Image("paris")
    .resizable()
    .aspectRatio(contentMode: .fill)
    .frame(width: 300)
//  .clipped() //裁剪超出的

圆形切图

Image("paris")
    .resizable()
    .aspectRatio(contentMode: .fill)
    .frame(width: 300)
    .clipShape(Circle())

透明度

Image("paris")
    .resizable()
    .aspectRatio(contentMode: .fill)
    .frame(width: 300)
    .clipShape(Circle())
    .opacty(0.5)
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容