我想知道調用外部XIB的正確方式是什麼。Monotouch:異步加載XIB
方法MonoTouch.Foundation.NSBundle.MainBundle.LoadNib
以同步方式加載XIB,但以這種方式,我無法覆蓋ViewDidLoad
方法。
特別是,我的目標是創建自定義UIViewController
並加載在IB中創建的XIB(此元素是附加到Superview的項目)。然後,我會在自定義UIView
上附加點按操作。在不重寫ViewDidLoad
方法的情況下,我無法做到這一點。
我怎樣才能找到一個很好的教程來理解我可以利用到UIViewController
所有不同的構造函數?
例如,你能解釋一下這些問題嗎?
public MyCustomView (IntPtr handle) : base(handle)
{
Initialize();
}
[Export("initWithCoder:")]
public MyCustomView (NSCoder coder) : base(coder)
{
Initialize();
}
public MyCustomView() : base("MyCustomView", null)
{
//---- this next line forces the loading of the xib file to be synchronous
MonoTouch.Foundation.NSBundle.MainBundle.LoadNib ("MyCustomView", this, null);
Initialize();
}
非常感謝。最好的祝福。