###前提・実現したいこと
https://i-app-tec.com/ios/tableview.html
を実行したい
###発生している問題・エラーメッセージ
コンパイルはできるが何も表示されない
エラーメッセージ 右側に色々表示されていて左には何も表示されません
###該当のソースコード
import UIKit class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var table: UITableView! let imgArray: NSArray = ["img0","img1","img2","img3","img4","img5","img6","img7"] let label2Array: NSArray = ["2013/8/23/16:04","2013/8/23/16:15", "2013/8/23/16:47","2013/8/23/17:10", "2013/8/23/1715:","2013/8/23/17:21", "2013/8/23/17:33","2013/8/23/17:41"] override func viewDidLoad() { super.viewDidLoad() } func tableView(_ table: UITableView, numberOfRowsInSection section: Int) -> Int { return imgArray.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) ->UITableViewCell { let cell = table.dequeueReusableCell(withIdentifier: "tableCell", for: indexPath) let img = UIImage(named: imgArray[indexPath.row] as! String) let imageView = cell.viewWithTag(1) as! UIImageView imageView.image = img let label1 = cell.viewWithTag(2) as! UILabel label1.text = "No." + String(indexPath.row + 1) let label2 = cell.viewWithTag(3) as! UILabel label2.text = String(describing: label2Array[indexPath.row]) return cell } func tableView(_ table: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 120.0 } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } }
回答2件
あなたの回答
tips
プレビュー