赞
踩
struct ContentView: View { var body: some View { GStack(rows: 4, cols: 4) { row, col in HStack { Image(systemName: "\(row*4+col).circle") Text("R\(row) C\(col)") } } } } struct GStack<Content:View>:View { let rows: Int let cols: Int let content: (Int, Int) -> Content var body: some View { VStack { ForEach(0..<rows) { row in HStack { ForEach(0..<cols) { column in content(row, column) } } } } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。