Ios TableView不显示数组
我有一个在加载后搜索服务的应用程序。不幸的是,我无法让我的表显示我的可变数组。它应该有一个单元格(根据Ios TableView不显示数组,ios,objective-c,arrays,uitableview,Ios,Objective C,Arrays,Uitableview,我有一个在加载后搜索服务的应用程序。不幸的是,我无法让我的表显示我的可变数组。它应该有一个单元格(根据NSLog(@“%lu”,(unsigned long)[self.services count]);)!除了牢房不在外,一切似乎都是正确的。我有相同的重用ID,数组有一个对象。下面提供了一段代码: “添加到数组”代码(它是代码顶部的第一个!): } 单元格代码: - (UITableViewCell *)tableView:(UITableView *)tableView cellFo
NSLog(@“%lu”,(unsigned long)[self.services count]);
)!除了牢房不在外,一切似乎都是正确的。我有相同的重用ID,数组有一个对象。下面提供了一段代码:
“添加到数组”代码(它是代码顶部的第一个!):
}
单元格代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
[self configureCell:cell atIndexPath:indexPath];
}
// Configure the cell...
cell.textLabel.text = [[_services objectAtIndex:indexPath.row]name];
NSLog([[_services objectAtIndex:indexPath.row] name]);
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
我还通过IB在代码中设置了委托/数据源:
self.tableView.dataSource = self;
self.tableView.delegate = self;
以下是一次运行的日志,该运行应该有效:
2013-11-06 17:35:37.808 TrolioDemo[5846:60b] Adding service from the delegate
2013-11-06 17:35:37.811 TrolioDemo[5846:60b] Keaton’s MacBook Pro
这应该是单元格的文本
2013-11-06 17:35:37.812 TrolioDemo[5846:60b] IT WORKED! MY TIME MACHINE WORKED!
2013-11-06 17:35:37.817 TrolioDemo[5846:60b] 1
这是自助服务阵列的计数
2013-11-06 17:35:37.818 TrolioDemo[5846:60b] Keaton’s MacBook Pro
通过情节提要将其更改为动态数组您是否正确地将代理和数据源链接到UIViewController?是的,通过编程和情节提要。您是否在情节提要中为UICellView设置了单元标识符?这些代理方法如何-NumberOfSectionsTableView-numberOfRowsInSection@Defoncesko这些都要结帐了。该部分返回1。我使用了NSLog(@“%lu”,(unsigned long)[self.services count]);它在-numberofrowsin部分吐出1
2013-11-06 17:35:37.818 TrolioDemo[5846:60b] Keaton’s MacBook Pro