Ceci est la tableView, comme vous pouvez le voir, quelle cellule a deux parties, la gauche, est une vue de gauche, et la droite, est la vue de droite. La couleur rouge et verte peut s'afficher, mais le droit que je crée ne peut pas s'afficher correctement. Qu'est ce qui ne va pas avec mon code? Je vous remercie.Pourquoi le texte factice ne peut pas charger sur ma cellule?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SectionsTableIdentifier = @"SectionsTableIdentifier";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:SectionsTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:SectionsTableIdentifier] autorelease];
}
cell.textLabel.textColor = [UIColor whiteColor];
UIView *rightUIView = [[UIView alloc] initWithFrame:CGRectMake(160, 0, 160, cell.frame.size.height)];
[rightUIView setBackgroundColor:[UIColor greenColor]];
UIView *leftUIView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, cell.frame.size.height)];
[leftUIView setBackgroundColor:[UIColor redColor]];
UILabel *rightLabel = [[UILabel alloc] init];
[rightLabel setText:@"dummy"];
[rightUIView addSubview:rightLabel];
[cell addSubView:leftUIView];
[cell addSubView:rightUIView];
}
Ce code n'affiche aucun de vos objets gauche/droitUIView. S'il vous plaît poster le code que vous utilisez réellement. Il y a probablement d'autres problèmes avec ce code, mais sans le code * original *, il s'agit simplement de deviner. – Eiko