J'ai un UITableViewCell personnalisé que j'ai créé dans IB. Mes étiquettes s'affichent lorsque je ne chevauche pas:Personnelle UITableViewCell n'apparaît pas lorsque la hauteur de ligne est définie
- (CGFloat)tableView:(UITableView *)tblView heightForRowAtIndexPath:(NSIndexPath *)indexPath
Cependant, mon contenu est écrasé. Je veux que la hauteur soit 120px j'ai donc les suivantes:
- (CGFloat)tableView:(UITableView *)tblView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{ CGFloat rowHeight = 120;
return rowHeight;
}
Je ne sais pas pourquoi le contenu à l'intérieur de mon UITableViewCell tout d'un soudain disparaît?
MISE À JOUR: Voici comment je crée la cellule:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"ARCell";
ARObject *myARObject;
myARObject = [items objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"ARCell" owner:self options:nil];
cell = arCell;
self.arCell = nil;
}
UILabel *label;
label = (UILabel *)[cell viewWithTag:0];
label.text = [NSString stringWithFormat:@"%@", myARObject.username];
label = (UILabel *)[cell viewWithTag:1];
label.text = [NSString stringWithFormat:@"%@", myARObject.created_at];
label = (UILabel *)[cell viewWithTag:2];
label.text = [NSString stringWithFormat:@"%@", myARObject.articleTitle];
label = (UILabel *)[cell viewWithTag:3];
label.text = [NSString stringWithFormat:@"%@", myARObject.intro_text];
return cell;
}
Sous l'onglet Taille dans IB, je mets W: 320 et H: 120 est-ce l'endroit correct? –