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