class ViewController: UIViewController {
@IBOutlet var labels: [UILabel]!
override func viewDidLoad() {
super.viewDidLoad()
labels[0].layer.borderWidth = 1
labels[0].layer.borderColor = UIColor.black.cgColor
}
}
答案 0 :(得分:2)
您可以loop
到labels
并将border
设置如下,
labels.forEach { (label) in
label.layer.borderColor = UIColor.black.cgColor
label.layer.borderWidth = 1.0
}