SwiftUI教程第1章第18节:Image-Mask

源码地址:https://github.com/fzhlee/SwiftUI-Guide

 

给图片添加遮罩效果。
示例代码:

VStack{

    Image("girlPicture")
	.clipShape(Circle())

    Image("girlPicture")
	.mask(Circle())

    Image("texture")
    .resizable()
    .frame(width: 300, height: 300)
    .mask(
	Text("SWIFT UI!")
	    .font(Font.system(size: 64).bold()))

}

查看运行结果

SwiftUI教程第1章第18节:Image-Mask_第1张图片

你可能感兴趣的:(iOS移动开发)