我试图让我的自定义 UITable View 仅显示来自不同类的图像。一切都编译但应用程序一打开它就会崩溃并告诉我“对象引用未设置为对象的实例”。 这是我的类(class),假设保存图像:pastebin。 com/QDjDVTdm 这是我的自定义表格单元格:http://pastebin.com/G3TLMfe4 这是我的表格来源:http://pastebin.com/xPDuhBeV
这是在我的 View Controller 中声明表的方式:
unclass[] lol= new unclass[2];
UITableView _table;
_table = new UITableView{
Frame = new CoreGraphics.CGRect(0, 30, View.Bounds.Width, View.Bounds.Height-30),
Source = new TableSource(lol)
};
_table.SeparatorStyle = UITableViewCellSeparatorStyle.None;
_table.RowHeight = UITableView.AutomaticDimension;
_table.EstimatedRowHeight = new nfloat (15.0);
View.AddSubview (_table);
最佳答案
来自评论:
您正在声明一个大小为 2 的数组 (new unclass[2]),但我看不到您将任何内容放入其中的位置。所以数组中的两个点都将为空。将一些对象放入数组中:
lol[0] = new unclass(...);
lol[1] = new unclass(...);
关于ios - 对象引用未设置为 UiTable 中对象 [Xamarin,IOS] 的实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32016887/