0
我想添加一個自定義視圖XIB到我的UITable視圖標題。在此鏈接How to add a custom view to a XIB file defined view in monotouch之後,我創建了一個帶有視圖的XIB。它只有兩個標籤。 然後我有一個cs文件。被稱爲XIB鏈接中提到MonoTouch:添加客戶視圖XIB
public override UIView GetViewForHeader(UITableView tableView, int sectionIndex) {
var myHeader = new UIView();
var views = NSBundle.MainBundle.LoadNib("CustomHeaderView", this, null);
CustomHeaderView loginView = Runtime.GetNSObject(views.ValueAt(0)) as CustomHeaderView;
loginView.UpdateWithData("test","test");
myHeader.AddSubview(loginView);
return myHeader;
}
當我運行應用程序它崩潰,沒有看到任何錯誤。
請提供來自應用程序輸出板的崩潰信息。 –