小编Jas*_*lor的帖子

UITableView中的断言失败configureCellForDisplay:forIndexPath:

看过其他类似的问题,我不确定错误在哪里.我收到了断言失败.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
Run Code Online (Sandbox Code Playgroud)

我认为这很简单,但希望有人可以提供帮助.

以下是我的代码:

#import "StockMarketViewController.h"

@interface StockMarketViewController ()

@end


@implementation StockMarketViewController
@synthesize ShareNameText, ShareValueText, AmountText;
@synthesize shares, shareValues;


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
    return [shares count];

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];



    NSString *currentValue = [shareValues objectAtIndex:[indexPath row]];
    [[cell textLabel]setText:currentValue];
    return cell;

}
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c uitableview ios

48
推荐指数
3
解决办法
4万
查看次数

标签 统计

cocoa-touch ×1

ios ×1

objective-c ×1

uitableview ×1