我正在尝试制作带有圆角的按钮。到目前为止,这就是我所拥有的。我不断收到“只能声明实例属性@IBOutlet”错误。
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
}
@IBOutlet var Button: UIButton! {
didSet {
Button.backgroundColor = .clear
Button.layer.cornerRadius = 5
Button.layer.borderWidth = 0.8
Button.layer.borderColor = UIColor.black.cgColor
}
}
@IBOutlet weak var sampleButton: UIButton! {
didSet {
sampleButton.layer.cornerRadius = 5
sampleButton.layer.borderWidth = 0.8
}
}