2017-04-11 60 views
-2
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: <#T##IndexPath#>) as! TableViewCell 
    cell.myButton. = recipies[indexPath.row] 
} 

我不知道在cell.mybutton.之後要添加什麼。如何將按鈕的文本更改爲變量?

這段代碼的頂部也被標記爲不正確在Xcode

回答

0

簡單好用的

cell.myButton.setTitle(recipies[indexPath.row], for: UIControlState.normal) 
+1

請不要回答重複的問題。相反,將它們標記爲重複項。 – JAL

+0

它說「價值的類型'UIView'沒有成員'setTitle' - 大聲笑,請幫我我是新來的Xcode – Arian

+0

好吧 - 你有一個不同的問題,它看起來像myButton是**不**定義爲一個UIButton,你可以包含你定義'myButton'的代碼 - 你創建它的地方myButton = UIButton ...還是你附加的插座? – Russell

相關問題