嗨,我是 Xcode 编程新手,在创建UITableView.
我正在阅读很多教程,并且我创建了一个TableViewController.
我已经有一个UIViewController带有 xib 的文件,UITableView里面包含一个。
我已经在TableViewController子类中实现了必要的方法,但我不知道如何TableView在屏幕上显示。
我尝试将表委托设置为 ,TableViewController但表未显示,并且它链接IBOutlet到我的UITableView.
请有人告诉我我做错了什么。
对不起,我的英语不好
编辑:非常感谢您的帮助
这是我的该方法的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier];
}
FichaItem * item = [sucursales objectAtIndex:indexPath.section];
cell.textLabel.text = [item.campos objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [item.datos objectAtIndex:indexPath.row];
return cell;
}
我真的看不出有什么问题,该代码几乎被复制和修改以显示我的数据。