문제

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;
    }               
}
}
.

메신저는 디바이스의 너비보다 많은 텍스트가 포함되어 있고 따라서 행이 크기가 커지면 텍스트가 더 많은 텍스트가 포함되어 있지 않으면 텍스트라벨이 스테치 / 래핑 할 것이라는 것을 알고 싶습니다.내가 선을 설정하면= 0;레이블을 래핑하지만 행 높이는 모든 행이 서로 겹치기 때문에 행 높이는 동일하게 유지됩니다.행 높이는 어떻게 성장합니까?

감사합니다

도움이 되었습니까?

해결책

hasunevenrows 또는 tableView에서 rowheight를 설정해야 할 수 있습니다

다른 팁

테이블 뷰 소스에서 다음 방법

을 무시하려고합니다.
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
 }
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top