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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:40:38+00:00 2026-06-08T21:40:38+00:00

So I have to admit, that I had this code working perfectly up until

  • 0

So I have to admit, that I had this code working perfectly up until a day or so ago when I added a new view, so I’m rather frustrated at the moment.

The setup:
I have a storyboarded app that contains a tabbar. In the AppDelegate, I have the following for attaching the CoreData

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
    UINavigationController *navigationController = [[tabBarController viewControllers] objectAtIndex:0];
    GamesViewController *controller = [[navigationController viewControllers] objectAtIndex:0];
    controller.managedObjectContext = self.managedObjectContext;

    return YES;
}

Also in the AppDelegate, I had this method that would set the standard tab background to an image of my choosing:

- (void)customizeInterface {    
    UIImage* tabBarBackground = [UIImage imageNamed:@"tab_background"];
    [[UITabBar appearance] setBackgroundImage:tabBarBackground];
}

So this all worked fine until I added another login view that precedes my tabs. I had to change what the CoreData was initially being set too (from my tabs to my login/initializing view). Below is the new setup of how the storyboard looks.

Here's the new setup in my storyboard

Now when the app loads up… the background image appears initially as before, but only on the first tab. Once I click off if it, it switches to the default gradient color again. If I go back to the first / initial tab, the background does not-reapply itself, it stays as the colored gradient.

Here is the amended applicationDidFinishLaunching code to go along with it:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //instantiate local context
    NSManagedObjectContext *context = [self managedObjectContext];
    if (!context) {
        // Handle the error.
        NSLog(@"Error: Context is null");
    }

    LoginViewController *rootViewController = [LoginViewController alloc];
    rootViewController.managedObjectContext = context;

    return YES;
}

So then what I tried to do, is go into the viewDidLoad in the first VC that my tabbar loads up (GameViewController) and tried adding this to fix the problem:

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tabBarController.tabBar setBackgroundImage:[UIImage imageNamed:@"dock_background"]];
}

That didn’t work, so I also tried using the same original code that I had in my AppDelegate and that also didn’t work:

- (void)viewDidLoad {
    [super viewDidLoad];
    UIImage* tabBarBackground = [UIImage imageNamed:@"tab_background"];
    [[UITabBar appearance] setBackgroundImage:tabBarBackground];
}

So… I’m sort of stuck. I’ve got to be doing (or not doing) something so obvious… Anyone out there have any tips / pointers?

Thanks a ton
– Drew

  • 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-08T21:40:40+00:00Added an answer on June 8, 2026 at 9:40 pm

    Delegate.h file

    @interface AppDelegate : UIResponder

    @property (strong, nonatomic) UIWindow *window;
    @property (strong, nonatomic) UIImageView *imgV;
    @property (strong, nonatomic) UIViewController *viewController;
    @property (strong, nonatomic) UITabBarController *tabBarController;
    
    @end
    

    Delegate.m file

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        // Override point for customization after application launch.
    
            self.viewController = [[DeskboardVctr alloc] initWithNibName:@"DeskboardVctr" bundle:nil];
    
    
    
    
        self.tabBarController = [[UITabBarController alloc] init];
        self.tabBarController.delegate=self;
        self.imgV=[[UIImageView alloc] init];
        self.imgV.frame=CGRectMake(0, 0, 1024, 49);
        [[self.tabBarController tabBar] insertSubview:self.imgV atIndex:1];
        self.tabBarController.delegate=self;
        self.window.rootViewController = self.viewController;
        [self.window makeKeyAndVisible];
    
        return YES;
    }
    

    Tabbar Delegate Methods

    - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
        NSUInteger index=[[tabBarController viewControllers] indexOfObject:viewController];
            switch (index) {
                case 0:
                    self.imgV.image=[UIImage imageNamed:@"t1.png"];
                    break;
                case 1:
                    self.imgV.image=[UIImage imageNamed:@"t2.png"];
                    break;
                case 2:
                    self.imgV.image=[UIImage imageNamed:@"t3.png"];
                    break;
                case 3:
                    self.imgV.image=[UIImage imageNamed:@"t4.png"];
                    break;
                case 4:
                    self.imgV.image=[UIImage imageNamed:@"t5.png"];
                    break;
                default:
                    break;
            }
        return YES;
    }
    

    Hope you may help this
    thanks

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

Sidebar

Related Questions

I have this simple script that I'm working on. I must admit, I'm totally
I have to admit that having not even tried to code this myself this
I have to admit that I'm new to Java and Android. db4o seems to
I have to admit in advance that I'm quite new to MVC, I've been
I admit that I have almost none experience of unittesting. I did a try
I have just installed Microsoft Robotics Studio 2008 R2, and I must admit that
Have a class definition that looks something like this class someClass(models.Model): field1 = models.ForeignKey('other_app.field4')
I have this login code, which works last night before I slept. Nobody used
This may be a n00b topic but, anyways, I have been having a rather
I have a service that I had to log on to the local admin

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.