我正在使用Xamarin运行2015 Visual Studio。当我启动iOS模拟器时,它在模拟器上显示黑屏。我正在使用带导航控制器的故事板。
AppDelegate代码(仅包含内容的方法。):
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow(UIScreen.MainScreen.Bounds);
// If you have defined a root view controller, set it here:
Window.RootViewController = new Controllers.RegistrationController();
// make the window visible
Window.MakeKeyAndVisible();
return true;
}
答案 0 :(得分:0)
您可以尝试以下方式:
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// create a new window instance based on the screen size
Window = new UIWindow(UIScreen.MainScreen.Bounds);
string storyboardName = "Main";
UIStoryboard storyboard = UIStoryboard.FromName(storyboardName, null);
// if it is the first viewcontroller
UIViewController vc = storyboard.InstantiateInitialViewController();
// If you have defined a root view controller, set it here:
Window.RootViewController = vc;
// make the window visible
Window.MakeKeyAndVisible();
return true;
}
如果您的故事板被称为Main.stroyboard,请尝试使用:
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
return true;
}
我测试了这两个选项,当故事板被称为Main
时,两者都应该有效答案 1 :(得分:0)
你需要从你的UINavigationController到一个包含其中内容的UIViewController。如果您没有segue,那么您的应用将显示黑屏,因为该应用并不认为它有任何内容。
如果我理解正确,您的故事板可能如下所示:Storyboard 1
您需要在两个视图控制器之间创建一个segue,以便您的故事板看起来像这样,并在两个视图控制器之间使用segue-arrow:Storyboard 2