Xamarin ios getcell stretch cellview dinamicamente
-
21-12-2019 - |
Domanda
Ho il seguente codice che ho adattato dall'esempio Xamarin MobileCrm:
[assembly: ExportCell(typeof(ListTextCell), typeof(ListTextCellRenderer))]
namespace Manager.iOS
{
class ListTextCellRenderer : TextCellRenderer
{
public override UITableViewCell GetCell(Cell item, UITableView tv)
{
var cellView = base.GetCell(item, tv);
cellView.TextLabel.Lines = 0;
return cellView;
}
}
}
.
IM Volendo averlo che il textLabel si aggravide / avvolgerà quando contiene più testo della larghezza del dispositivo e quindi le righe crescono in termini di dimensioni.Quando impostare le linee= 0;Avvolge l'etichetta ma l'altezza della riga rimane la stessa così ogni riga si sovrappone a vicenda.Come posso coltivare anche l'altezza di riga?
Grazie
Soluzione
Potrebbe essere necessario impostare hasunevenrows o il sorriso sul tuo tavolo da tavola
Altri suggerimenti
Nella tua sorgente della tabella Vista, dovresti sovrascrivere il seguente metodo
public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
{
var text = new NSString(yourTextHere);
var size = text.StringSize(UIFont.FromName("FontName", fontSize), new SizeF(tableView.Frame.Width, 70)); // The 70 can be any number, the width is the important part
return size.Height + 16; // 16 is for padding
}
. Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow