タイトルの通りです。見た事もないエラーが発生して原因が分かりません。コードは間違ってないと思うのですが、何が原因なのでしょうか??、また、現在は、テーブルビューとそのセルを実装している段階であります。
とりあえず、目的としてはテーブルのビューの動きを見たいので、まずは、String型の配列を用意してその配列の中に3つの文字列要素を格納しました。この3つの要素を3つのセルとしてFirstViewControllerに表示を行いたいです。
ちなみにですが、identfireはしっかりと、MyCellと同じように書いております。
エラーの原因をどなたがご教示願います。
宜しくお願い致します。
Swift
1import UIKit 2 3class FirstViewController: UIViewController , UITableViewDelegate, UITableViewDataSource{ 4 5 6 @IBOutlet weak var UserName: UILabel! 7 var RichUser:[String] = ["猫", "犬", "亀"] 8 9 override func viewDidLoad() { 10 super.viewDidLoad() 11 // Do any additional setup after loading the view, typically from a nib. 12 } 13 14 override func didReceiveMemoryWarning() { 15 super.didReceiveMemoryWarning() 16 // Dispose of any resources that can be recreated. 17 } 18 19 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 20 return RichUser.count 21 } 22 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 23 let Cell : UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "MyCell")! 24 self.UserName.text = RichUser[indexPath.row] 25 return Cell 26 } 27 func tableView(tabeleView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {} 28} 29 30
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。