【发布时间】:2020-04-19 23:51:14
【问题描述】:
ZStack{
RoundedRectangle(cornerRadius: 8).foregroundColor(.red).scaledToFit()//.frame(width: 200, height: 25)
HStack{
Image(systemName: "tag.fill").foregroundColor(.white)
Text("Tickets Not Available").font(.headline).foregroundColor(.white).fixedSize(horizontal: true, vertical: false)
}
}.scaledToFit()
如您所见,我的视图放置在 zstack 中,因此圆角矩形可以作为文本视图的背景。我已经尝试了很多不同的事情,比如将 .scaledtofit 放在哪里,它每次都会给我带来奇怪的结果。
【问题讨论】: