foriin0..<10{
letbtn = UIButton()
btn.backgroundColor = UIColor.red
letmargin =7
letcount =4
letrow = i / count
letcol = i % count
letw =140
leth =44
letx = col * (margin + w) +30
lety = row * (margin + h) +30
btn.frame = CGRect(x: x, y: y, width: w, height: h)
content.addSubview(btn)
}
网友评论