Mar*_*rcy 34
对于 Xcode 13 中的图像文字,请输入:
#imageLiteral(
Run Code Online (Sandbox Code Playgroud)
应显示图像文字并可用于选取图像。
这似乎也适用于其他文字:
#colorLiteral(
#fileLiteral(
Run Code Online (Sandbox Code Playgroud)
这会将文字放入代码中,而无需代码完成。代码完成对我来说也停止了对文字的工作。
选择图像后,注释该行以查看文件名(如果需要)。
scr*_*guy -1
不确定这是否正是您要问的,但是...您可以使用 Image() 函数将图像添加到视图中,该函数将图像文件路径作为参数。您可以在函数之后使用方法来用它做各种事情。例如,将图像裁剪成圆形,调整其大小,并添加白色轮廓:
Image("<file path>")
.resizable()
.frame(width: screenSize.width / 2,
height: screenSize.width / 2)
.clipShape(Circle())
.overlay(Circle().stroke(Color.white, lineWidth: 5))
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10472 次 |
最近记录: |