页面布局
HStack 横向布局
VStack(alignment: .center) {
Image("11")
.frame(width: 100, height: 100)
.clipShape(Circle())
.padding(.bottom,10)
Text("Hello, world!")
.foregroundColor(.red)
.font(.system(size: 50))
Spacer()// 页面空白填充
}
VStack 纵向布局
HStack(alignment: .center) {
Image("11")
.resizable(capInsets: EdgeInsets(), resizingMode: .stretch)
.frame(width: 100, height: 100)
.clipShape(Circle())
.padding(.bottom,10)
Text("Hello, world!")
.foregroundColor(.red)
.font(.system(size: 50))
}
ZStack 叠加布局
ZStack(alignment: .center) {
Image("11")
.resizable(capInsets: EdgeInsets(), resizingMode: .stretch)
.frame(width: 100, height: 100)
.clipShape(Circle())
.padding(.bottom,10)
Text("Hello, world!")
.foregroundColor(.red)
.font(.system(size: 50))
}