Tab view problem

JeffreyBieseckerJeffreyBiesecker USMember, University

I have a project that has a navigation controller and the a simple view controller as its root. When I use the following code

        MainCallButton.TouchUpInside += (object sender, EventArgs e) =>
        {
            // Launches a new instance of CallHistoryController
            AddNewViewController MainView = Storyboard.InstantiateViewController("AddNewViewController") as AddNewViewController;
            if (MainView != null)
            {
                this.NavigationController.PushViewController(MainView, true);
            }
        };

I receive this error.

Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: Storyboard () doesn't contain a view controller with identifier 'AddNewViewController'

this code works for another view or a tableview. does tabviewneed to be root view? I am thinking yes. But how would I do this?

Thanks,

Jeffrey Biesecker

Posts

  • GlennStephens.8241GlennStephens.8241 AUXamarin Team, University, XamUProfessors, Developer Group Leader Xamurai

    Hi Jeffrey,

    When you are using the storyboard editor each UIViewController has its class name, but it also has an Storyboard ID. It is the id for the ViewController, not the class name that determines which screen to create and that id is also case sensitive.

    It is the value in the Storyboard ID that needs to be passed to the Storyboard.InstantiateViewController and you should be ok.

    Regards,
    Glenn

Sign In or Register to comment.