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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:45:43+00:00 2026-06-08T12:45:43+00:00

When I create a XCode 4 iPhone template for TabBarController with storyboard, its automaticly

  • 0

When I create a XCode 4 iPhone template for TabBarController with storyboard, its automaticly configured with a main view controller and everything. But there is no propery for the Tab Bar Controller in the AppDelegate. Can I created an outlet for it, and tryed to link it with my Tab Bar Controller in storyboard but that’s not possible. Is there a better way to access the Tab Bar Controller in didFinishLaunchingWithOptions method, as it’s already kind of hooked up? What I want is self.currentController = current tab in Tab Bar Controller.

AppDelegate.h:

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end

AppDelegate.m:

@interface AppDelegate()

@property (nonatomic, assign) UIViewController<SubViewContainer> *currentController;

@end

@synthesize window = _window
@synthesize currentController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

//I need this piece of code to equal the Tab Bar Controller current tab
self.currentController = ?

return YES;
}

//And I'm gonna use this void for some statements about the Tab Bar Controller tabs:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:
(UIViewController *)viewController
{
// with some statements
}
  • 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-08T12:45:45+00:00Added an answer on June 8, 2026 at 12:45 pm

    Assuming things are set up in your storyboard as expected, this should give you a reference to the tab bar controller in didFinishLaunchingWithOptions::

    NSLog(@"Root: %@", self.window.rootViewController);
    UITabBarController *tabController = (UITabBarController *)self.window.rootViewController;
    

    Usually, you could get the current controller using…

    self.currentController = [tabController selectedViewController];
    

    …but since no controller has been selected at the time this method executes, the best guess of what you want is…

    self.currentController = [[tabController viewControllers] objectAtIndex:0];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

info: iOS5, xcode4.3.2, iphone5 Create tab view controller application from xcode template wizard. Following
I am using xcode 4.2 with storyboard to create an iphone app. When I
I create a brand new Single View Application iPhone app in Xcode 4.2, it
I am trying to create multiple views in my view-based iPhone app in Xcode
How can I create a iPhone screenshot? When I open Xcode I go to
I want to create a new project in Xcode (4.2), but I don't need
I have created an iphone application using the empty template without ARC in xcode
I worked with iPhone Xcode Traget to create multiple iPhone apps with single code
Why can't XCode 4 create XIB file while using storyboard: is it 2 incompatible
I have xcode 3.2.5 x64. Im creating a standard iphone openglES template application. By

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.