0

I've recently completed an Android app in Xamarin and am now working through creating an iOS application. I'm not sure if I've missed something extremely basic here, but I'm having trouble understanding how you transition from one screen to another.

In the MultiScreen demo app, this is achieved with a navigation controller and segue. I also saw the code sample which shows you to do this manually, calling the:

NavigationController.PushViewController(YourView, true);

And this works fine assuming you want to be able to navigate between the two.

The first thing my users see is a login screen. If the user successfully logs in, I want to send them to a home screen. As you can imagine, it makes no sense that you would 'go back' to the login page. I've seen it is possible to hide the navigation bar, but I just wanted to check first... Is there an alternative way to transition to the home page without using a NavigationController ?

Thank you in advance.

1 Answer 1

1

You can hide and show the navigation "Back" button

    public override void ViewDidLoad ()
{
    base.ViewDidLoad ();

    this.NavigationItem.SetHidesBackButton (true, true);  //Hide
    //this.NavigationItem.SetHidesBackButton (false, true);//Show
}

if you dont want to use a UINavigationController then you can use PresentViewController() and DismissViewController() to navigate

nextViewController nextVC = new nextViewController();
PresentViewController(nextVC, true, null);

There is also an example here that demonstrates how to use those 2 methods

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for your reply. I did see that it was possible to hide it. But can you just clarify - is a NavigationController required in order to move to to the next screen, regardless of whether you need to be able to link back to it? This wasn't clear in the documentation on the Xamarin website, hence my confusion :S
No a UiNavigationController isnt necessary to navigate , but it simplify things alot , especially for someone who is not very familiar with iOS.
If thw answer helped you please accept it. Thank you
Happy to credit you for the answer. Are you able to point me in the direction of some Xamarin documentation which shows how to do it without a Navigation Controller?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.