从xamarin Ios中的App代表导航时的黑色窗口

时间:2017-04-21 12:07:41

标签: xamarin.ios navigation

导航到视图控制器后我得到一个黑色的窗口。我的应用程序从OpenUrl方法调用app delegate中的页面。

 public override bool OpenUrl(UIApplication app, NSUrl url, string sourceApp, NSObject annotation)
    {
        var rurl = new Rivets.AppLinkUrl(url.ToString());
       // navController = new UINavigationController();
        var id = string.Empty;


        if (rurl.InputQueryParameters.ContainsKey("id"))
            id = rurl.InputQueryParameters["id"];

        if (rurl.InputUrl.Host.Equals("products") && !string.IsNullOrEmpty(id))
        {
            // var mainController = new UIViewController();

           // NSUserDefaults.StandardUserDefaults.SetBool(true, "ForgotPwdLinkClicked");
           return true;
        }
        else
        {
            //var c = new ProductViewController();
            // UIApplication.SharedApplication.KeyWindow.RootViewController = c; 
            var c = new UpdatePasswordViewController();
           navigationController.ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen;
           navigationController.PushViewController
                (c, true);
            //// return true ;
            ///*this.Window.RootViewController =
            //    c;*/
           // NSUserDefaults.StandardUserDefaults.SetBool(true, "ForgotPwdLinkClicked");
            return true;
        }
    }

这些是我在XCode中的ViewController设置:

this is the Property of the page This is the image of the View which i want to call

1 个答案:

答案 0 :(得分:0)

本规范解决了我的问题

 UIStoryboard Storyboard = UIStoryboard.FromName("MainStoryboard", null);// this will bee our storyboard name 
var c = Storyboard.InstantiateViewController("UpdatePasswordViewController") as UpdatePasswordViewController;