1
無法導入UITableViewDataSource如果我使用一個自定義單元格BaseCell
。只有UITableViewCell
作品雖然BaseCell
從類型UITableViewCell
不能使用UITableViewDataSource與自定義單元格
import UIKit
class XptoViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var table: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(_ tableView:UITableView, numberOfRowsInSection section:Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> BaseCell {
let cell = BaseCell()
return cell
}
}
要返回的UITableViewCell沒有自定義類細胞。 –
@TusharSharma粘貼錯誤的代碼;) – bruno
你已經註冊的小區?爲什麼繞過出隊?數據源是否設置?代表組? – Larme