Page Navigation in xamarin.iOS using code

ranju_ranju_ Member ✭✭

How can I implement page navigation in xamarin ios without using segue? Currently I am using following code but it doesn't seem to work

   if (True Condition)
                    {

                       UserHomeController callHistory = this.Storyboard.InstantiateViewController("UserHomeController") as UserHomeController;
                       this.NavigationController.PushViewController(callHistory, true);

                    }

Answers

  • ColeXColeX Member, Xamarin Team Xamurai
    edited December 2018
    • Make sure that the current viewcontroller is included with the storyboard .
      If not , use UIStoryboard.FromName("Main",null) instead of this.Storyboard.

    • Make sure that the current viewcontroller is wrapped inside a navigation .

    Try to make debug on callHistory and this.NavigationController to see if the value exists or not.

  • ranju_ranju_ Member ✭✭

    @ColeX said:

    • Make sure that the current viewcontroller is included with the storyboard .
      If not , use UIStoryboard.FromName("Main",null) instead of this.Storyboard.

    • Make sure that the current viewcontroller is wrapped inside a navigation .

    Try to make debug on callHistory and this.NavigationController to see if the value exists or not.

    I used UIStoryboard.FromName("Main",null) instead of this.Storyboard, But still not working. Can you please let me know how can I be sure about the second point(current viewcontroller is wrapped inside a navigation)? In storyboard I have set the current view controller as root view using navigation controller.

  • ColeXColeX Member, Xamarin Team Xamurai

    Can you please let me know how can I be sure about the second point(current viewcontroller is wrapped inside a navigation)?

    If you set the current view controller as root view using navigation controller , then it is .

    Have you set Storyboard ID in Properties menu ?

  • ranju_ranju_ Member ✭✭

    Yes..I have set that.

  • ColeXColeX Member, Xamarin Team Xamurai

    @ranju_ said:
    Yes..I have set that.

    Would you mind share us a basic project that reproducing the problem ?

  • ranju_ranju_ Member ✭✭

    I tried sharing the stroryboard image and code behinds But I am not allowed currently.
    You have to be around for a little while longer before you can post links. Can you please tell me some work around for this

  • ColeXColeX Member, Xamarin Team Xamurai

    The forum has some limitation for the new comers , such as posting image , link .. you need wait before you can post them(maybe tomorrow) , no better ways.

Sign In or Register to comment.