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

  • Home
  • SEARCH
  • 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 6650309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:52:39+00:00 2026-05-26T00:52:39+00:00

So lets say that I am in viewcontroller, C and I want to transition

  • 0

So lets say that I am in viewcontroller, C and I want to transition to viewcontroller D (which is voteView here). So here’s what I did:

VoteViewController * voteView = [[VoteViewController alloc] init];
        voteView.voteInfo = [array objectAtIndex:0];

    NSArray * viewControllers = [self.navigationController viewControllers];
    if ([[viewControllers objectAtIndex:0] isKindOfClass:[ListViewController class]]){
        NSLog(@"LIST VIEW");
    } else if ([[viewControllers objectAtIndex:0] isKindOfClass:[SpotListingViewController class]]){
        NSLog(@"SPOT LISTING");
    }

    [self.navigationController setViewControllers:[NSArray arrayWithObjects:[viewControllers objectAtIndex:0], [viewControllers objectAtIndex:1], voteView, nil]];
    [voteView release];

Running the code above, it prints LIST VIEW, which means that the RootViewController is a ListViewController. Now theoritically at VoteViewController when I do as below:

 if ([[viewControllers objectAtIndex:0] isKindOfClass:[ListViewController class]]){
            NSLog(@"LIST VIEW");

it should print LIST VIEW, however it doesn’t. Why is this? I also checked the count of the view controller and it’s only 2. Why is it different?

  • 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-26T00:52:40+00:00Added an answer on May 26, 2026 at 12:52 am

    If your ask is to transition to View Controller D (or voteView), you should be doing-

    [self.navigationController pushViewController:voteView animated:YES];
    

    Related to your question, when you call setViewControllers: and access object at index 1, have you ensured that the array has two objects? In which method of voteView did you put the NSLog?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say that I have an executable and when it is started I want
Lets say that I have 4 view controllers (call them FirstView,SecondView,ThirdView,FourthView) which are created
Lets say that i have a class with some instance variables and i want
First of all, I just want to say that I begin at Objective-C. Here
Lets say that I have a JSON object called fruits and this is the
Lets say that you have websites www.xyz.com and www.abc.com. Lets say that a user
Lets say that I have a header user control in a master page, and
Lets say that input from the user is a decimal number, ex. 5. 2155
Lets say that I am writing a program that supports plugins and I write
Lets say that you have a business object whose current state implies that there

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.