Request for member variables is something not a structure
Okay so I am creating a custom uitablviewcell in IB and the class I have created is called CustomCell I have imported it in the header file and here is some code
// 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;
}
why is there an error and what can i do to fix it.
Do you have class for your CustomCell(UITableViewCell) and have the member usernameText, regionText, gamesText, infoText, concoleText, micText, and ageText of your CustomCell ? If no then you will get a warning Request for member variables is something not a structure because these are not the member variable. If you have not created separate class file for that then you may call cell.textLabel.text = @"Welcome" textLabel is the member of UITableViewCell.
and you did not tell use what ERROR you were getting?
精彩评论