Question

I was trying out doing a manual instantiation of a view and all I get is a black screen.

Here's the core of my FinishedLoading

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

note: CurrentController is a protected UIViewController currentController

ChoicesScreen is defined in IB, has the proper outlets, actions, etc. in other words its a valid view.

I tried the default constructor for ChoicesScreen and got the same thing. Obviously I'm missing something in how to get my own screen up.

Was it helpful?

Solution

Driss,

You need to set the frame for the new view, to define where it'll show in the view:

currentController = new ChoicesScreen(this.window.Handle);
currentController.View.Frame = new System.Drawing.RectangleF(0, 0, 320, 480);
window.AddSubview (currentController.View);
window.MakeKeyAndVisible();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top