美文网首页
swift 入门小图制作

swift 入门小图制作

作者: namjui | 来源:发表于2016-07-17 20:46 被阅读15次

    for a in 1..<5 {
    print(a)
    for b in 1...a {
    print(b)

                let mayView = UIView()
                mayView.frame = CGRect(x: 80 * b, y: 40 * a, width: 65, height: 30)
                if  b == 2 && a == 3{
                    mayView.backgroundColor = UIColor.yellowColor()
                    
                }
                else {
                    
                    mayView.backgroundColor = UIColor.greenColor()
                }
                self.view.addSubview(mayView)
            }
        }
        
        let any = ["姓名:", "性别:", "年龄:"]
        for i in 0..<any.count {
            let label = UILabel()
            label.text = any[i]
            label.frame = CGRect(x: 90, y: 45 * i, width: 200, height: 100)
            self.view.addSubview(label)
            
        }

    相关文章

      网友评论

          本文标题:swift 入门小图制作

          本文链接:https://www.haomeiwen.com/subject/cehpjttx.html