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 8569287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:17:59+00:00 2026-06-11T18:17:59+00:00

I have my app is a TabBarController, and I have to take different actions

  • 0

I have my app is a TabBarController, and I have to take different actions depending on which tab is pressed, so, I delegate TabBarContoller, and I got it.

Now in case a tab which contents a NavigationController is pressed, depending on a database value, the view that should be shown is the first one or the last one, so in Tabs.m:

-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
 NSArray *viewArrays = [(UINavigationController*)viewController viewControllers];

switch (tabBarController.selectedIndex) {

    case 3:
    {
        NSString *query = @"SELECT * FROM login";
        sqlite3_stmt *statement = [[Database alloc] select:query];

        if(sqlite3_step(statement) == SQLITE_ROW) {
           [(UINavigationController*)viewController popToViewController:[viewArrays objectAtIndex:1] animated:YES];

        }
        sqlite3_finalize(statement);
        break;
    }
    default:
        break;
}

}

The problem is objectAtIndex:1 doesn’t exist right now

  • 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-06-11T18:18:00+00:00Added an answer on June 11, 2026 at 6:18 pm

    You can popView only if you have done pushView atleast once. Print and see the objects inside self.navigationController.viewControllers using NSLog and if it contains some object then give your index appropriately(within the range), i am confused why you are doing (UINavigationController*)viewController, try this instead

    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:2] animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app which has a UITabBarController, and when different tabs are pressed,
I have one existing app for iphone with tabBarController and NavigationController.Now i want to
I have an iPhone app which has a tabBarController as the root view controller
In my iPhone app I have implemented a custom tab bar which functions perfectly,
I am doing an app based on tabbarController. I have a 3 tabbar items.
I'm trying to build an app where I have a TabBarController with 4 entries.
We have App A as main app. Now we build from it App B
I have app in which i have recorded sound files i want that i
lets say i have app id, app secret id and user uid now i
for example: I have app A, which references library A and library B. in

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.