0

我正在尝试手动实例化视图,但得到的只是黑屏。

这是我的 FinishedLoading 的核心

currentController = new ChoicesScreen(this.window.Handle);
window.AddSubview (currentController.View);
window.MakeKeyAndVisible();

注意:CurrentController 是一个protected UIViewController currentController

ChoicesScreen 在 IB 中定义,具有适当的出口、操作等。换句话说,它是一个有效的视图。

我尝试了 ChoicesScreen 的默认构造函数并得到了同样的结果。显然,我在如何启动自己的屏幕方面遗漏了一些东西。

4

1 回答 1

1

德里斯,

您需要为新视图设置框架,以定义它将在视图中显示的位置:

currentController = new ChoicesScreen(this.window.Handle);
currentController.View.Frame = new System.Drawing.RectangleF(0, 0, 320, 480);
window.AddSubview (currentController.View);
window.MakeKeyAndVisible();
于 2010-01-18T19:24:58.400 回答