System.InvalidCastException Xamarin IOS

时间:2018-08-07 14:31:08

标签: c# ios xamarin xamarin.ios

我的程序非常简单,有两个视图控制器,一个按钮在按下时会转到下一个视图控制器。起初它起作用了,但是当我现在尝试执行它时,我收到了:

  

System.InvalidCastException:<超时超出了获取异常的详细信息>

这是告诉按钮切换视图控制器的代码:

partial void Knapp1_TouchUpInside(UIButton sender)
    {
        UIStoryboard storyboard = this.Storyboard;
        ViewControllerTwo ViewController = (ViewControllerTwo)
            storyboard.InstantiateViewController("ViewControllerTwo");

        this.PresentViewController(ViewController, false, null);
        throw new NotImplementedException();
    }

以下两行代码旁边会弹出错误消息:

ViewControllerTwo ViewController = (ViewControllerTwo)
            storyboard.InstantiateViewController("ViewControllerTwo");

我不确定如何解决此问题,谢谢!

0 个答案:

没有答案