2011-09-25 80 views
-2

好了,所以我創建的IB定製uitablviewcell,我已經創建了被稱爲CustomCell 我已經在頭文件導入後,這裏的類是一些代碼申請成員變量的東西不是一個結構

// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString *CellIdentifier = @"CustomCell"; 

CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 

    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; 

    for (id currentObject in topLevelObjects){ 
     if ([currentObject isKindOfClass:[UITableViewCell class]]){ 
      cell = (CustomCell *) currentObject; 
      break; 
     } 
    } 
} 

//errors start 
cell.usernameText.text = [usernameArray objectAtIndex:[indexPath row]]; 
cell.regionText.text = [regionArray objectAtIndex:[indexPath row]]; 
cell.gamesText.text = [gamesArray objectAtIndex:[indexPath row]]; 
cell.infoText.text = [aboutArray objectAtIndex:[indexPath row]]; 
cell.concoleText.text = [concoleArray objectAtIndex:[indexPath row]]; 
cell.micText.text = [NSString stringWithFormat:@"Mic:%@",[MicArray objectAtIndex:[indexPath row]]]; 

cell.ageText.text = [ageArray objectAtIndex:[indexPath row]]; 
    //till her 
return cell; 
} 

爲什麼會出現錯誤,我該如何解決它。

+0

使用'@interface CustomCell'發佈代碼? – Nekto

回答

1

你有類的CustomCell(UITableViewCell中) ,並有成員usernameText,regionText,gamesText,信息文本,concoleText,micText,和你的CustomCell的ageText?如果沒有,那麼你會得到一個警告請求成員變量是不是結構,因爲這些不是成員變量。如果你還沒有創建單獨的類文件,那麼你可以調用單元格。 textLabel .text = @「Welcome」textLabel是UITableViewCell的成員。

和你沒有告訴用什麼錯誤你越來越?

+0

我做了一堂課CustomCell,它有所有可用的東西 –

+0

**你正在得到什麼錯誤**?你也應該提供錯誤。 –

+0

會員請求:/ –

相關問題