我无法弄清楚如何更改rowHeight
iPad应用中表格的Xamarin
。以前我曾在iPhone应用程序上工作,调整行的大小就像调用TableSource
类中的以下内容一样简单:
public override float GetHeightForRow (UITableView tableView, NSIndexPath indexPath)
{
return 95f;
}
然而,我发现这不是在iPad应用程序中调用的。是否有其他方法我应该打电话,或者我只是这样做完全错了?
答案 0 :(得分:2)
看起来你正在通过覆盖GetHeightForRow来正确地做到这一点,但是如果它没有改变它我建议在控制器上检查你的ViewDidLoad方法,以确保它将tableview源设置为你的自定义tableSource类。
例如,在ViewDidLoad
:
_tableview.Source = new TableSource();
答案 1 :(得分:0)
简单方法。创建自定义电视:
public class CustomTableViewStyle : UITableView
{
public CustomTableViewStyle (System.Drawing.RectangleF frame)
{
Initialize (frame);
}
void Initialize (System.Drawing.RectangleF frame)
{
Frame = frame;
AutoresizingMask = UIViewAutoresizing.All;
ScrollEnabled = true;
SectionFooterHeight = 0;
AllowsSelection = true;
AllowsMultipleSelection = false;
SeparatorColor = UIColor.FromRGB (239, 243, 243);
RowHeight = 210; <-- // Your table row height!
SeparatorInset = UIEdgeInsets.Zero;
DelaysContentTouches = true;
CanCancelContentTouches = true;
}
}
如果您不想创建自己的,只需更改表RowHeight
上的属性即可。
不要忘记在故事板中为TableView或Id创建一个类。