0
我正在嘗試使用parent
和child
accordion cells
創建單個tableview
。對於這個手風琴單元格,我創建了兩個單元格到單個單元格tableview storyboard
中,並給出了單獨的Identifier
和兩個單元格的類,並在下面的方法中執行了一些邏輯。現在的問題是我需要訪問自定義單元類,並且我已經將outlets
單元格storyboard UI
連接到自定義類,但是我不能在以下方法中訪問該UI。如何使用目標C訪問自定義類到主類中?
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
//cell = [[[NSBundle mainBundle] loadNibNamed:@"CCell" owner:self options:nil] objectAtIndex:1];
cell = [tableView dequeueReusableCellWithIdentifier:@"parentCell"];
}
NSDictionary *dicForIndex = [self.arForTable objectAtIndex:indexPath.row];
if ([[dicForIndex valueForKey:@"isChild"] boolValue] == YES) {
//cell = [[[NSBundle mainBundle] loadNibNamed:@"CCell" owner:self options:nil] objectAtIndex:0];
cell = [tableView dequeueReusableCellWithIdentifier:@"childCell"];
UILabel *labelName = (UILabel*)[cell viewWithTag:1001];
labelName.text = [dicForIndex valueForKey:@"name"];
}else{
UILabel *labelName = (UILabel*)[cell viewWithTag:1001];
labelName.text = [dicForIndex valueForKey:@"name"];
}
[cell setIndentationLevel:[[[self.arForTable objectAtIndex:indexPath.row] valueForKey:@"level"] intValue]];
return cell;
}
那你要訪問? 「細胞」?什麼是「細胞」的類名? – anhtu
實際上,我已經創建了兩個單元格到tableview storyboard中,上面提到的兩個自定義類我使用的代碼,但是plm我不能訪問上面的方法@ anthu –
「兩個自定義類」中的自定義類出口UI。它是什麼名字? – anhtu