self.view.backgroundColor=UIColor.cyanColor() let label1 = UILabel(frame: CGRectMake(100,100,50)) label1.text="label1" label1.textAlignment=NSTextAlignment.Center label1.numberOfLines=0 //var color=UIColor(red: 245.0,green: 250.0,blue: 248.0,alpha: 1) label1.backgroundColor=UIColor.lightGrayColor() var lfont = UIFont(name: "ga",size: 14) label1.font = lfont //var textColor=UIColor(red: 100,green: 100,blue: 100,alpha: 1) label1.textColor=UIColor.blackColor() self.view.addSubview(label1)
原文链接:https://www.f2er.com/swift/326700.html