Sto aggiornando la mia app su iOS 7 e finalmente l'ho ottenuta, ma c'è una cosa per cui non riesco a trovare una soluzione.sizeWithFont: constrainedToSize: lineBreakMode: deprecato in iOS7
In Xcode 4 Ho usato il seguente metodo:
#define FONT_SIZE 14.0f
#define CELL_CONTENT_WIDTH 280.0f
#define CELL_CONTENT_MARGIN 10.0f
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; {
NSString *text = [textA objectAtIndex:[indexPath row]];
CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), 20000.0f);
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
CGFloat height = MAX(size.height, 28.0f);
return height + (CELL_CONTENT_MARGIN * 2);
}
Ma avrò un errore quando lo si utilizza in iOS 7:
Uso -boundingRectWithSize: opzioni: attributi: contesto :
Non so come convertire la mia versione precedente in questo nuovo metodo e sarebbe bello se qualcuno potesse lp me Grazie in anticipo.