尝试了解 mvvmcross 和 xib 编辑器 - 我遵循了示例代码
http://slodge.blogspot.co.uk/2013/01/uitableviewcell-using-xib-editor.html
并在我的代码中加入了一些。
namespace ConX.UI.Touch.Cells
{
[Register("JobCell")]
public partial class JobCell : MvxBaseBindableTableViewCell
{
public static NSString Identifier = new NSString("JobCell");
public const string BindingText = @"{'JobDescription':{'Path':'Description'}, 'JobScheduledForDate':{'Path':'ScheduledForDate'}, 'JobNumber':{'Path':'JobNo'}}";
public JobCell(): base(BindingText)
{
}
public JobCell(IntPtr handle): base(BindingText, handle)
{
}
public JobCell (string bindingText): base(bindingText, UITableViewCellStyle.Default, Identifier)
{
}
public string JobDescription
{
get { return this.DescriptionLabel.Text; }
set { this.DescriptionLabel.Text = value; }
}
public string JobScheduledForDate
{
get { return ScheduledForDateLabel.Text; }
set { ScheduledForDateLabel.Text = value; }
}
public string JobNumber
{
get { return NumberLabel.Text; }
set { NumberLabel.Text = value; }
}
}
}
using MonoTouch.Foundation;
namespace ConX.UI.Touch.Cells
{
partial class JobCell
{
[Outlet]
MonoTouch.UIKit.UILabel DescriptionLabel { get; set; }
[Outlet]
MonoTouch.UIKit.UILabel ScheduledForDateLabel { get; set; }
[Outlet]
MonoTouch.UIKit.UILabel NumberLabel { get; set; }
void ReleaseDesignerOutlets ()
{
if (DescriptionLabel != null) {
DescriptionLabel.Dispose ();
DescriptionLabel = null;
}
if (ScheduledForDateLabel != null) {
ScheduledForDateLabel.Dispose ();
ScheduledForDateLabel = null;
}
if (NumberLabel != null) {
NumberLabel.Dispose ();
NumberLabel = null;
}
}
}
}
我只是无法通过引发以下错误来完成这项工作 - 似乎没有创建网点?
System.NullReferenceException: Object reference not set to an instance of an object
at ConX.UI.Touch.Cells.JobCell.set_JobDescription (System.String value) [0x00008] in
/Volumes/ConXPrototype/Conx.UI.Touch/Cells/JobCell.cs:32
at
ConX.UI.Touch.Views.BaseJobListView`2+TableSource[ConX.Core.ViewModels.JobListViewModel,Syst
em.DateTime].GetOrCreateCellFor (MonoTouch.UIKit.UITableView tableView,
MonoTouch.Foundation.NSIndexPath indexPath, System.Object item) [0x00025] in
/Volumes/ConXPrototype/Conx.UI.Touch/Views/BaseJobListView.cs:101
at Cirrious.MvvmCross.Binding.Touch.Views.MvxBaseBindableTableViewSource.GetCell
(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
[0x00000] in <filenam
非常感谢克恩