我想表明我的表视图定制的电池。我正确地做了这些步骤表视图没有显示我的自定义单元格
- 添加一个表视图到故事板。
- 设计使所述细胞与两个按钮,一个图像视图,和三个标签。
- 在.h文件中为我的标签,图像视图设置iboutlets,为它的单元格和子类添加一个类。使用uitableviewcell
- 。
我做这些事情
- 从Web服务中获得的一些值,并将其加载到数组中的viewDidLoad中。
- 中的cellForRowAtIndexPath我已创建的单元格,只加载一些值,我需要在细胞中显示。为了测试,我只是给标签提供一个示例文本。
但是当我运行该应用所设计的细胞不显示。只有空行在那里。
什么是错了,我没有...我无法理解......请帮助我的人..
下面是我的代码
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";
// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
duplicateCell *cell = (duplicateCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.delegate_D = self;
// TacleCell *cell = (TacleCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
//cell.delegate = self;
// Configure the cell...
NSArray* currentDuplicates = [self.duplicateArray objectAtIndex:indexPath.row];
NSLog(@"DUPLICATE IN DUPLICATE:%@",currentDuplicates);
cell.Name_D.text = @"test name";
return cell;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
//#warning Potentially incomplete method implementation.
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//#warning Incomplete method implementation.
// Return the number of rows in the section.
NSLog(@"COUNT:%[email protected]",[self.duplicateArray count]);
return [self.duplicateArray count];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
//self.navigationItem.rightBarButtonItem = self.editButtonItem;
[self.tableView registerClass:[duplicateCell class] forCellReuseIdentifier:@"cell"];
self.title = @"Duplicate Req";
self.duplicateArray = [TableViewController getDuplicateList];
NSLog(@"DUPZ %@",self.duplicateArray);
}
请帮助我的人......
编辑:下面的图像将帮助你了解我的情况,我认为..
这里是我的故事Bord ..你可以看到最后一个视图控制器(在右上角)是我谈论的一个。它旁边还有一个功能相同的功能,但它的功能就像是一种魅力。我使用了相同的代码,并遵循相同的步骤。为什么这不显示我正确的结果..?
我已经解决了ISSUE..I都给予了WRONG SEGUE。我所做的就是,我之间创造了两条表意见SEGUE并执行SEGUE IN MY ALERT VIEW..NOW正常工作......
谢谢大家WHO指导我..
从viewDidLoad中取出的registerClass并再次检查** ** Name_D连接到类文件 –
一直在cellIdentifier被提供给故事板的电池? – AppleDelegate
是的,我没有包括它..但是当我运行该应用程序时,它给了我cellforRowAtindexpath方法中第二行的错误。这就是为什么我包括该行。如果我删除它,它给了我这个错误终止应用程序由于未捕获的异常'NSInternalInconsistencyException',原因:'无法使标识符单元出列单元格 - 必须注册一个标记的nib或类或连接故事板中的原型单元格' – Darshana