Je crée une cellule UITableView de la manière suivanteLe texte de la cellule UITablview se déplace tout seul?
const NSInteger TOP_LABEL_TAG = 1001;
UILabel *topLabel;
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell =[[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier]
autorelease];
UIImage *indicatorImage = [UIImage imageNamed:@"indicator.png"];
cell.accessoryView =[[[UIImageView alloc] initWithImage:indicatorImage]
autorelease];
const CGFloat LABEL_HEIGHT = 25;
UIImage *image = [UIImage imageNamed:@"64x64.png"];
topLabel =[[[UILabel alloc] initWithFrame:CGRectMake(
image.size.width + 2.0 * cell.indentationWidth,
0.8 * (tableView.rowHeight - 1.7 * LABEL_HEIGHT),
tableView.bounds.size.width -
image.size.width - 4.0 * cell.indentationWidth
- indicatorImage.size.width,
LABEL_HEIGHT)] autorelease];
[cell.contentView addSubview:topLabel];
topLabel.tag = TOP_LABEL_TAG;
topLabel.textColor = [UIColor colorWithRed:0.25 green:0.0 blue:0.0 alpha:1.0];
topLabel.highlightedTextColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0];
topLabel.font = [UIFont systemFontOfSize:20];
topLabel.textAlignment== UITextAlignmentCenter;
}
else
{
topLabel = (UILabel *)[cell viewWithTag:TOP_LABEL_TAG];
}
topLabel.text = [NSString stringWithFormat:[aboutArray objectAtIndex:[indexPath row]]];
topLabel.textAlignment=UITextAlignmentCenter;
première fois lorsque la table charge le fonctionnement tableView fine.But lorsque je navigue vers la page d'une autre page, le texte dans la première cellule de mouvements de table sur la droite et seulement la moitié de celui-ci visisble .. Quelle pourrait être la raison possible pour cela ??
Veuillez corriger votre indentation. Il est très incohérent, ce qui le rend plus difficile à lire que nécessaire. –