7
私はMyStyledStringElementクラスを作成し、StyledStringElementとIElementSizingをサブクラス化して、スタイル付きストリング要素の幅を制御します。残念ながら、以下のコードはgetheight()内のセルの高さのサイズを変更するだけです。私が使用できるgetWidth()メソッドや、スタイリングされたストリング要素の幅を調整してUIButtonと同じように見えるものがありますか?常に前もって感謝します。monotouch.dialog styledstringelementセル幅を調整する
public override UITableViewCell GetCell (UITableView tv)
{
var cell = base.GetCell (tv);
cell.AutosizesSubviews = false;
//tv.TranslatesAutoresizingMaskIntoConstraints = false;
cell.ClipsToBounds = false;
cell.Frame.Width = 30;
cell.Bounds.Width = 30;
cell.Frame.Size = new System.Drawing.SizeF (30, 30);
return cell;
}
#region IElementSizing implementation
public float GetHeight (UITableView tableView, NSIndexPath indexPath)
{
//throw new NotImplementedException();
tableView.Frame.Width = 10;
//tableView.Bounds.Width = 10;
tableView.Frame.Height = 10;
Console.WriteLine (tableView.ToString());
return 10;
}
#endregion