줄 바꿈 모드를 wordwrap로 설정하고 lines 속성을 7로 설정 한 간단한 사용자 정의 multiline 요소가 있습니다. 텍스트가 잘 랩되지만 셀 높이는 그대로 유지됩니다. 따라서 텍스트는 셀 경계를 확장합니다. 셀의 프레임을 늘리고 GetHeight를 재정의하려고 시도했지만 어느 경우에도 작동하지 않는 것 같습니다. 또한 GetHeight가 호출 된 것 같지 않습니다.Monotouch 대화 상자의 multiline 요소 높이가 늘어나지 않습니다.
어떤 얼굴이 비슷한가요? 문제가 무엇인지에 대한 아이디어가 있습니까?
public class DisclaimerMultilineElement : MultilineElement
{
public DisclaimerMultilineElement (string caption) : base(caption)
{
}
public DisclaimerMultilineElement (string caption, string value) : base(caption, value)
{
}
public DisclaimerMultilineElement (string caption, NSAction tapped) : base(caption, tapped)
{
}
public override float GetHeight (UITableView tableView, NSIndexPath indexPath)
{
var ht = base.GetHeight (tableView, indexPath);
//return base.GetHeight (tableView, indexPath);
return 400.0f;
}
public override UITableViewCell GetCell (MonoTouch.UIKit.UITableView tv)
{
UITableViewCell cell = base.GetCell (tv);
var frame = cell.Frame;
frame.Height = 300f;
//cell.Frame = new System.Drawing.RectangleF(frame.X, frame.Y, frame.Width, frame.Height);
cell.BackgroundColor = UIColor.Clear;
cell.TextLabel.Font = UIFont.BoldSystemFontOfSize (12);
cell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap;
cell.TextLabel.Lines = 7;
cell.TextLabel.TextAlignment = UITextAlignment.Left;
cell.TextLabel.Text = Value;
return cell;
}
}