以下のサイトを参考にしたのコードを書いたのですが、実行してみるとAppDelegate.swiftにエラー文[Theard 1:signal SIGABRT]とでました。
改善策をお願いします。
それと、main.storyboardの画面をついでに載せておきます。
![イメージ説明]WIDTH:600
![イメージ説明]WIDTH:600
lang
1import UIKit 2 3class ViewController: UIViewController , UITableViewDataSource, UITableViewDelegate{ 4 5 @IBOutlet var tableView : UITableView? 6 7 let imgArray: NSArray = ["img01.jpg","img02.jpg","img03.jpg","img04.jpg", 8 "img05.jpg","img06.jpg","img07.jpg","img08.jpg"] 9 10 let label2Array: NSArray = ["2013/8/23/16:04","2013/8/23/16:15","2013/8/23/16:47","2013/8/23/17:10", 11 "2013/8/23/1715:","2013/8/23/17:21","2013/8/23/17:33","2013/8/23/17:41"] 12 13 override func viewDidLoad() { 14 super.viewDidLoad() 15 } 16 17 //Table Viewのセルの数を指定 18 func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 19 return imgArray.count 20 } 21 22 //各セルの要素を設定する 23 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 24 25 // tableCell の ID で UITableViewCell のインスタンスを生成 26 var cell = tableView.dequeueReusableCellWithIdentifier("TableCell", forIndexPath: indexPath) as! UITableViewCell 27 28 var img = UIImage(named:"\(imgArray[indexPath.row])") 29 // Tag番号 1 で UIImageView インスタンスの生成 30 var imageView = tableView.viewWithTag(1) as! UIImageView 31 imageView.image = img 32 33 // Tag番号 2 で UILabel インスタンスの生成 34 let label1 = tableView.viewWithTag(2) as! UILabel 35 label1.text = "No.\(indexPath.row + 1)" 36 37 // Tag番号 3 で UILabel インスタンスの生成 38 var label2 = tableView.viewWithTag(3) as! UILabel? 39 label2?.text = "\(label2Array[indexPath.row])" 40 41 42 return cell 43 } 44 45 override func didReceiveMemoryWarning() { 46 super.didReceiveMemoryWarning() 47 } 48 49}
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。