let label = UILabel(frame:CGRect(x:0,y:0,width:150,height:200)); label.text="i am a am a label am a label am a labellabel"; label.font = UIFont.boldSystemFont(ofSize: 20) label.font = UIFont.systemFont(ofSize: 20) label.textColor=UIColor.cyan label.backgroundColor=UIColor.blue label.textAlignment=NSTextAlignment.center label.shadowColor=UIColor.orange //设置label行数 ,0表示无限行,(不超过label的宽高) label.numberOfLines=0 self.view.addSubview(label)