我想知道调用外部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();
}
非常感谢。最好的祝福。