Monotouch.dialog styledstringelement adjusts cell width

I create my class MyStyledStringElement and a subclass of StyledStringElement and IElementSize, trying to control the width of the styled element. Unfortunately, the code below resizes the cell height in getheight (). Is there a getWidth () method that I can use or something similar to adjust the width of the styled element of the string so that it looks just like UIButton? As always, thanks in advance.

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 
+7
source share
1 answer

The last time I looked at this, the width is controlled by a UITableView. It would be best to add UIButton as a child of the UITableViewCell and return the height that the button should contain.

+1
source

All Articles