2016-10-27 8 views
-1

異なるセクションでテーブルビューを実装しようとしています。このコードを入力する前に、アプリは正常に実行されました。私はこのエラーが適切に接続されていないアウトレットからポップアップすることを理解しているので、エラーは私のTableViewで設定したIBOutletから来ていると思います。しかし、私は何が間違っているのか分かりません。以下は私のコードです:Swift 'thread 1 signal sigabrt'エラー

import UIKit 

class MainPageVC: UIViewController, UITableViewDelegate, UITableViewDataSource { 


@IBOutlet weak var tableView: UITableView! 


override func viewDidLoad() { 
    super.viewDidLoad() 
    tableView.delegate = self 
    tableView.dataSource = self 

} 
let textCellIdentifier = "cell" 

let items = ["My Items", "Needed Items", "Future Items"] 

func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { 
    return items[section] 
} 

func numberOfSections(in tableView: UITableView) -> Int { 
    return items.count 
} 

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
    return 1 
} 

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 
    let cell = tableView.dequeueReusableCell(withIdentifier: textCellIdentifier, for: indexPath) 


    return cell 
} 



override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
} 

}

+0

あなたがアウトレットが正しくないことが分かっている場合は、正しいものにしてください。 IBOutletsを削除して再作成することができます –

+0

問題を解決しません。私はテーブルビューを正しく設定したかどうか、または私に欠けているものがあるかどうかを調べたいと思っています。 – Kevin

答えて

1

私はテーブルビューでプロトタイプセルに入れていない、これはエラーを処分しました。

関連する問題