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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:40:38+00:00 2026-05-13T10:40:38+00:00

I have a TabBar in my application and I do this in my AppDelegate:

  • 0

I have a TabBar in my application and I do this in my AppDelegate:

...
test2ViewController = [[Test1ViewController alloc] init];
...
navigationTest2Controller = [[UINavigationController alloc] initWithRootViewController:test2ViewController];

NSArray *myControllers = [NSArray arrayWithObjects:..., navigationTest2Controller, nil];
[self.myTabBarController setViewControllers:myControllers animated:NO];

Now I have the problem that I am in a ViewController and I want to switch to the “navigationTest2Controller”. I do this in my AppDelegate with:

self.myTabBarController.selectedViewController = navigationTest2Controller;

This works. It switches to this ViewController! This ViewController was already loaded and the viewDidLoad method was called. In this viewDidLoad method is a methos call:

[self myMethod];

I want, that if the view switches to this ViewController this “myMethod” should always be called.
How can I do this? In my AppDelegate before the line

self.myTabBarController.selectedViewController = navigationTest2Controller;

??? Or is there another delegate which will be called every time the ViewController is selected/switched to?

Does anyone know this?

Thanks a lot in advance & Best Regards.

  • 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-13T10:40:39+00:00Added an answer on May 13, 2026 at 10:40 am

    You should place any code that you want to run when the view becomes visible in the -viewWillAppear: or -viewDidAppear method of your view controller.

    EDIT: To make this happen only when you switch from a certain view, you can subclass UITabBarController, only modifying the –tabBarController:shouldSelectViewController: method. In that method, you could do something like this:

    - (BOOL)tabBarController:(UITabBarController *)tabBarController
    shouldSelectViewController:(UIViewController *)viewController
    {
        if (self.selectedIndex == 1 &&
            [viewController respondsToSelector:@selector(myMethod)]) {
            [viewController myMethod];
        }
    
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this at my appdelegate: for 1st app: - (void)applicationDidFinishLaunching:(UIApplication *)application { [window
I am new to this iphone development.I have created a tab bar application which
I have a tabbar application. And the item of first tab is Navigation Controller.
I have developed a tabBar application in iphone,it uses 4 tabs to show the
I have following problem: I have built a tabbar application with 4 tabs. I
I have a tabBar App, with 5 tabs. The application was built in previous
I have requirement as following like showing ABPeoplePickerNavigationController in tabbar based application. I researched
I currently have an iPhone application with a tabbar and multiple viewcontrollers. All the
I have an iOS 5 Tabbed Application, using Storyboards. My Tabbar Controller points to
I have a tabbar application that has one screen that displays statistics based on

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.