我得到以下错误:"无法赋值:'word'是'let'常数"我无法弄清楚为什么会发生这种情况.如果有人可以帮助我,我会非常感激.
这是代码:
import UIKit
class ViewController: UIViewController {
var word1 = ""
@IBOutlet weak var label: UILabel!
func writeWord(word: String){
word = "Example"
}
@IBAction func button(sender: AnyObject) {
writeWord(word1)
label.text = word1
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Run Code Online (Sandbox Code Playgroud) 我希望按钮只能在我创建的自定义多边形形状中进行反应,而不是在CGRect框架中.
button.frame只支持CGRect.