Objective c 单元格文本未在UITableView中显示

Objective c 单元格文本未在UITableView中显示,objective-c,uitableview,Objective C,Uitableview,我在视图控制器中有一个UITableView。非常奇怪,因为显示的是标题和标题文本,而不是单元格文本 - (void)viewDidLoad { table.delegate = self; selection= [[NSMutableArray alloc] init]; [selection addObject:@"text"]; [selection addObject:@"text"]; [selection addObject:@"text"]; ...} - (UITableVi

我在视图控制器中有一个UITableView。非常奇怪,因为显示的是标题和标题文本,而不是单元格文本

- (void)viewDidLoad
{

table.delegate = self;
selection= [[NSMutableArray alloc] init];

[selection addObject:@"text"];
[selection addObject:@"text"];
[selection addObject:@"text"];
...}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// configure the cell in each row

static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease]; 
}
NSString *cellValue = [selection objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
//  cell.textColor=[UIColor blackColor];
    return cell;
}
尝试添加这一行

table.dataSource = self;
这样,只要类符合UITableViewDataSource协议,就可以调用所有表视图数据源方法(包括CellForRowatineXpath:)