在Swift3,我有一個按鈕聲明如下:可可錯誤:類型的值「NSButton」沒有成員「的setTitle」
@IBOutlet weak var transmitButton: NSButton!
我試圖把它的標題:
func textViewDidChange(_ textView: NSTextView) {
// If we're already transmitting, stop
if transmitButton.state == NSOnState {
transmitButton.setNextState()
transmitButton.setTitle("On", for: .normal)
}
}
,我得到這個錯誤:
Value of type 'NSButton' has no member 'setTitle'
我會很感激的任何想法/
所有你需要做的是設置標題,無需對的setTitle :'transmitButton.title =「On」' – RichAppz