0
なぜ私のテーブルビューにデータが入らないのでしょうか?私はビューコントローラの中にテーブルビューを持っていますが、ガイドに従ってみましたが、テーブルビューに何も表示されません。スイフト3私のテーブルビューは表示されません?
ここに私のコードは
だ@IBOutlet weak var weatherTableView: UITableView!
var items: [String] = ["Sunny", "Cloudy", "Rainy"]
override func viewDidLoad() {
super.viewDidLoad()
self.weatherTableView.register(UITableViewCell.self, forCellReuseIdentifier: "WeatherCell")
// Do any additional setup after loading the view.
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:UITableViewCell = self.weatherTableView.dequeueReusableCell(withIdentifier: "WeatherCell")! as UITableViewCell
cell.textLabel?.text = self.items[indexPath.row]
return cell
}
私はここで何かが足りないのですか?
事前にあなたの助け
hohohohoああ私はあなたのコードを追加した後、私のviewcontrollerにUITableViewDelegateを割り当てていないことを知りました。助けてくれてありがとう! – user3175707