你好,我一直在困難的問題一段時間。我試圖在ViewController
中加載兩個TableView
。我正在使用自定義UITableViewCells
與筆尖爲一個UITableView
和我正在使用正常UITableViewCell
爲另一個。當UITableView
,註冊筆尖被載入,但事情正在工作時,與非定製TableViewCell
的UITableView
加載我真的發現了以下錯誤:在視圖控制器中的兩個UITableView加載器
unable to dequeue a cell with identifier Cell1 - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
這是我的代碼:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView==tbl_search)
{
cell_intelisearch *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
if (cell==nil)
{
cell =[[cell_intelisearch alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
[cell.btn_options addTarget:self action:@selector(add_Action_sheet:) forControlEvents:UIControlEventTouchUpInside];
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
//------FOR POP UP TABLE------
else
{
static NSString *CellIdentifier = @"Cell1";
UITableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell1==nil)
{
cell1 =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell1.textLabel.text=[arr_pop_up_status objectAtIndex:indexPath.row];
return cell1;
}
}
任何幫助會非常感激。
感謝您的答案...但我應該提到的是,我所做的非定製按代碼表 – user3744496