问题描述
我似乎无法理解如何确保我的文本覆盖并适合圆形图像的边界。这是我目前所拥有的。
const jwt = "abc123";
const expiresIn = 60 * 60 * 24 * 5 * 1000;
const options = { secure: true,sameSite: 'none',httpOnly: true,maxAge: expiresIn };
res.cookie('jwt',jwt,options );
SwiftUI 有没有办法让它工作?我将如何实现这一目标?
解决方法
struct ClippedCircleView: View {
@State var text: String = "Reaaaallllllyyyyyy Looooooongggggg"
// Make this any number you are comfortable with
@State var letterLimit: Int = 12
var body: some View {
Circle()
.frame(width: 100,height: 100)
.overlay(
Text(text)
//Limit to 1 line until your letterLimit
.lineLimit(text.count <= letterLimit ? 1 : nil)
//Clips it to shape
.clipShape(ContainerRelativeShape()).padding()
.foregroundColor(Color.red)
//This makes super tiny letters so adjust to your use case
.minimumScaleFactor(0.1)
)
}
}