小编Ris*_*hab的帖子

无法从其DataSource获取单元格

以下代码有什么问题

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    NSString *CellIdentifier  = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    cell.textLabel.text = @"hello";

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
Run Code Online (Sandbox Code Playgroud)

但我无法从其dataSource获取一个单元格

整个例外是

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7ffe0b092800; frame = (0 97; 414 590); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7ffe0acf3b10>; layer = <CALayer: 0x7ffe0aceb6e0>; contentOffset: {0, 0}; contentSize: {414, 88}>) failed to obtain a cell from its dataSource (<AllContactsViewController: 0x7ffe0ace60f0>)'
Run Code Online (Sandbox Code Playgroud)

我为表视图设置了委托和数据源

objective-c uitableview ios

63
推荐指数
3
解决办法
6万
查看次数

launchscreen.storyboard和main.storyboard之间有什么区别

我用Google搜索了两个单词,却找不到任何东西.我从来没用过它.虽然我们有main.storyboard,但有没有必要呢.

ios xcode-storyboard launch-screen

28
推荐指数
1
解决办法
2万
查看次数