Nascondere il separatore UITableView dietro contentView
-
07-07-2019 - |
Domanda
Ho creato un UITableView raggruppato in iPhone OS 3.0 che sembrava l'immagine a sinistra. Il risultato è l'immagine giusta in OS 3.1.
imageView si trova sotto i separatori.
Ho provato a mettere in primo piano la visualizzazione del contenuto. La proprietà separatorStyle sembra ignorata quando tableView è in stile raggruppato (per disegnare da solo il separatore). La modifica del colore del separatore produce risultati nelle stringhe.
Grazie per l'aiuto!
Modifica: questo è il codice senza modifiche apportate:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.font = [UIFont boldSystemFontOfSize:18.0];
}
cell.textLabel.text = [[metro.arretDirection objectAtIndex:indexPath.row] name];
NSString* name;
if (indexPath.row == 0) {
name = @"Begining";
}
else if (indexPath.row + 1 == [metro.arretDirection count]) {
name = @"End";
}
else {
if ([[[metro.arretDirection objectAtIndex:indexPath.row] lines] count]== 1) name = @"Little";
else name = @"Big";
}
UIImage* metroImage = [[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%i%@.png", metro.metroNumber, name]]];
cell.imageView.image = metroImage;
[metroImage release];
return cell;
Soluzione 2
La risposta era in realtà abbastanza semplice, basta aggiungere un UIImageView
nella cella in un posto giusto invece di usare l'immagine integrata.
Altri suggerimenti
Sulla cella prova a impostare clipsToBounds su NO. ad es. cell.clipsToBounds = NO;