【发布时间】:2014-06-02 17:16:44
【问题描述】:
我正在尝试从 OwnerDrawnElement 继承(如文档中所述)。一切似乎都在工作,除了高度方法从未被调用,所以我无法设置单元格的高度。高度方法永远不会被调用(断点永远不会命中)。我试图强制重新实现 IElementSizing 并将该方法再次实现为新方法。同样,这也没有受到打击。这是精简的代码
public class CustomDrawElement : OwnerDrawnElement, IElementSizing
{
public CustomDrawElement (UITableViewCellStyle style, string cellIdentifier) : base (style, cellIdentifier)
{
}
#region implemented abstract members of OwnerDrawnElement
public override void Draw (System.Drawing.RectangleF bounds, MonoTouch.CoreGraphics.CGContext context, MonoTouch.UIKit.UIView view)
{
UIColor.Blue.SetFill ();
context.FillRect (bounds);
}
public override float Height (System.Drawing.RectangleF bounds)
{
return 220f;
}
#endregion
public new float GetHeight (UITableView tableView, NSIndexPath indexPath) {
return 220f;
}
}
创建对象时,我仅用于测试目的:
var e = new CustomDrawnElement(UITableViewCellStyle.Default, "myKey");
我目前使用的是最新的 Xamarin Studio 3。
我已经阅读了关于这门课的所有问题,似乎没有人遇到过这个问题。不确定是否是由于引入了新错误的新 3 版本。
【问题讨论】:
标签: xamarin monotouch.dialog xamarin-studio