Swift UI 4X 视图布局

Swift UI 4X 视图布局_第1张图片
图纸
Swift UI 4X 视图布局_第2张图片
实物
import UIKit

class ViewController: UIViewController {
    
    let W = UIScreen.mainScreen().bounds.width //屏幕宽度
    let H = UIScreen.mainScreen().bounds.height //屏幕高度
    
    let allView = 20 // 全部视图个数
    
    let mainViewW:CGFloat = 70   //视图宽度
    let mainViewH:CGFloat = 100 //视图高度
    let totalloc = 4 //列数
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let margin = (W - mainViewW * CGFloat(totalloc))/5 //边缘
        
        for i in 0..
如何增加及判断组件的交互事件:详情进入——>

你可能感兴趣的:(Swift UI 4X 视图布局)