I use the command:

[[UITabBar appearance] setBackgroundImage: [UIImage imageNamed:backGroundImageName]; 

From the delegate for the first time it works. Then I'm from one tabview trying to call the same command, but nothing happens.

Where to look for an error?

  • Method call in the main thread? - VioLet
  • If I understand correctly, then the first time - yes. Then from ViewController. - Indeets
  • In detail, this is what happens: one of the tabs is a transparent view, in which the UIAction menu with the Theme selection is called. When choosing a topic, I call the class method Theme "update Topic". I change different parameters (toolbar, navbar). Everything changes, except the background of the tabBar. - Indeets
  • [[self.tabController tabBar] setBackgroundImage: [UIImage imageNamed: newBarImageBackGround]]; - Worked from the new open tabview. But how to do it globally? - Indeets
  • [UITabBar appearance] is a proxy object. It participates only in the creation of UI elements, does not change the existing ones. - Alexander Sviridov

1 answer 1

If customization is common for all UITabBar in an application, it’s enough to call this thing once, if not, you can try calling in different classes

 [[UITabBar appearanceWhenContainedIn: self, nil] setBackgroundImage: [UIImage imageNamed:backGroundImageName]; 

In addition, if you have access directly to the UITabBar instance, as a property, for example:

 self.tabBar.backgroundImage = UIImage(named:backgroundImageName) 

better to do so than through appearance.