Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6008733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:51:59+00:00 2026-05-23T01:51:59+00:00

So if I am on a screen I can navigate to the next navigation

  • 0

So if I am on a screen I can navigate to the next navigation screen using the pushViewController and I simply get to the next screen, with a backButton to the previous screen.

Does the previous screen , (the screen which the back button pushes us to) … does it have a name ? (Like previousViewController os something like that ) ??

My goal behind this question:

If I have 5 screens (1, 2, 3, 4, 5 respectively)… lets say I navigate from 1 -> 3, and in another case I navigate from 2 -> 3. I want to say that if the “PreviousViewController was 1” then navigate from 3 to 4 (1 -> 3 -> 4), else if the previousViewController was 2, I want to navigate to 3 to 5 (2 -> 3 -> 5)…

How do I accomplish something like that ?

Thanks !

p.s.
I know I could also try something sensible and logical with another approach and just pushViewController accordingly. But if there is a solution for checking the previousViewController, it would make my task easy and would be a great learning experience.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:52:00+00:00Added an answer on May 23, 2026 at 1:52 am

    You can actually do that by using the viewControllers property of UINavigationController. This is what Apple says about it:

    The root view controller is at index 0 in the array, the back view controller is at index n-2, and the top controller is at index n-1, where n is the number of items in the array.

    Your “previous controller” is what Apple defines “back view controller”, corresponding to index n-2:

    NSUInteger arraySize = [navController.viewControllers count];
    UIViewController* prevController = [navController.viewControllers objectAtIndex:count-2];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can i navigate screens on button click. there are two buttons , previous
How can I display a splash screen using C or C++ in Windows? What
I'm trying to create a simple table navigation screen in WPF using the entity
I am using ViewFlipper to navigate between screens. Each screen has 4 images in
In my BlackBerry application, I have a home screen. The user can then navigate
I have a screen capturing utility on which I can rubber band an area
I have three buttons in on screen,when i click each button it navigate to
I want to create a helper screen that can create a bunch of Django
I have a screen where you can enable/disable modules for my Android application. For
For my users I need to present a screen where they can input multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.