Pergunta

Eu tenho o seguinte código que adaptei do exemplo do 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;
    }               
}
}

Eu quero que o TextLabel seja stetch/wrap quando contiver mais texto do que a largura do dispositivo e, portanto, as linhas aumentarão de tamanho com ele.Quando defino Lines = 0;ele envolve o rótulo, mas a altura da linha permanece a mesma, de modo que cada linha se sobrepõe.Como faço para aumentar a altura da linha também?

Obrigado

Foi útil?

Solução

Você pode ter que definir HasunEvenrows ou o rowheight em sua tableView

Outras dicas

Na sua fonte tableView você desejará substituir o seguinte método

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
 }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top