僅使用Table Views,我向第一個單元格添加了一個標籤,我試圖將其拖到視圖控制器以實現廣告代碼,但它不起作用。 (編程上還很新穎)iOS Table Views
這就是現在在視圖控制器中的全部內容。
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
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.
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_tableView:UITableView, cellForRowAtIndexPath index, Path: NSIndexPath) -> UITableViewCell{
return
}
}
也因爲這個,我得到「參數需要一個明確的類型錯誤
func tableView(_tableView:UITableView, cellForRowAtIndexPath index, Path: NSIndexPath) -> UITableViewCell {
return
}
你給視圖控制器分配了一個類? – hussain
您不會返回任何需要返回「UITableViewCell」的方法。你應該去找一個關於如何在iOS中使用'UITableView'的教程。它會幫助你...很多。 – Fogmeister
你能推薦一個視頻嗎?我正在關注如何做到這一點的視頻,直到我無法添加標籤,我被卡住了 – Sas