Sto usando sotto il codice per creare un aspetto più grande e più pulito su un UITableView semplice (non raggruppato). Funziona bene a meno che non abbia una tabella vuota, quindi l'altezza della cella è impostata all'altezza normale. Ho lo standard Separatorstyle (le linee grigie) così sembra brutto se è vuoto.L'altezza delle celle UITableview non sta funzionando in una tabella vuota?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
return 75;
}
Qualche idea su come risolvere questo problema?
EDIT:
trovato una soluzione ancora migliore dove neppure non visualizzare le linee se la tabella è "vuoto" e testo visualizza guida invece.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if ([dataArray count] == 0) {
[theTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
[pleaseAddStuffText setHidden:NO];
} else {
[theTableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
[pleaseAddStuffText setHidden:YES];
}
return [dataArray count];
}
Per "tabella vuota", intendi il tuo 'numberOfSectionsInTableView:' e/o 'tableView: numberOfRowsInSection:' restituisce 0? –
Correggere il mio buon signore. – David
quindi il tuo 'tableView: heightForRowAtIndexPath:' non dovrebbe mai essere chiamato, puoi impostare un breakpoint per verificarlo. –