Tworzę moją klasę MyStyledStringElement i podklasę StyledStringElement i IElementSizing, próbując kontrolować szerokość styledstringelement. Niestety, poniższy kod zmienia tylko wysokość komórki w getheight(). Czy istnieje metoda getWidth(), której mogę użyć lub coś podobnego do dostosowania szerokości stylu, aby wyglądał tak samo jak UIButton? Jak zawsze z góry dzięki.monotouch.dialog styledstringelement dostosuj szerokość komórki
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