ContainerViewControllerでTableViewを表示しようとすると
「Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x101024400; frame = (0 0; 240 385); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x170240bd0>; layer = <CALayer: 0x17002f4e0>; contentOffset: {0, 0}; contentSize: {240, 4400}>) failed to obtain a cell from its dataSource (<Ê≠ª„Å≠.sineViewController: 0x100a09ce0>)'」
というようなエラーが表示されてアプリが落ちます。
ContainerViewControllerのコードとStoryboardは以下のようになっています。
Swift
1override func viewDidLoad() { 2 super.viewDidLoad() 3 } 4 5 override func didReceiveMemoryWarning() { 6 super.didReceiveMemoryWarning() 7 } 8 9 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 10 return 100 11 } 12 13 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 14 let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) 15 cell.textLabel?.text = "test"; 16 return cell 17 }
tableviewのcellにはStoryboardでidentifierを振っています。
一体どこがおかしいのでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/23 11:20
2016/12/23 11:34
2016/12/23 12:35
2016/12/23 14:00
2016/12/23 14:24
2016/12/23 15:00
2016/12/23 23:21