• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Change background color of UITabBarItem and UITabBar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change background color of UITabBarItem and UITabBar


  • Subject: Re: Change background color of UITabBarItem and UITabBar
  • From: Angelica Grace Tanchico <email@hidden>
  • Date: Wed, 27 Jan 2010 15:06:59 +0800
  • Importance: Normal

Hi Greg,

Thanks for this information. It did change the color of the TabBar.
But the other question is still unanswered. Is it possible to change
the TabBarItem's image colors? Instead of default gray (when not selected)
and blue (when selected)? How?

Thanks! Really appreciate it!


Regards,
Angie

------------------------------------

> Is it possible to change color of UITabBar instead of the default color black?
> And also is it possible to change background color of UITabBarItem's background
> color instead of default color blue? If yes, how?

There is no API for changing the UITabBar.  Yet, you can subclass the TabBarController and override the viewDidLoad method.  For example,

@interface UITabBarController (private)
- (UITabBar *)tabBar;
@end

@implementation CustomUITabBarController

- (void)viewDidLoad {
    [super viewDidLoad];

    CGRect frame = CGRectMake(0.0, 0.0, self.view.bounds.size.width, 48);
    UIView *v = [[UIView alloc] initWithFrame:frame];
    [v setBackgroundColor:[UIColor redColor]];
    [v setAlpha:0.5];
    [[self tabBar] addSubview:v];
    [v release];
}

@end

This would set a red tint to the tab bar.  Check on stackoverflow.com for many more examples.  Keep in mind the above example modifies the tabBar of the controller, which is specifically mentioned in the documentation not to mess with.  So, use at your own risk.

Greg


_________________________________________________________________
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Change background color of UITabBarItem and UITabBar
      • From: Greg Reichow <email@hidden>
  • Prev by Date: Re: Global in NSApplication
  • Next by Date: Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")
  • Previous by thread: Re: Change background color of UITabBarItem and UITabBar
  • Next by thread: Re: Change background color of UITabBarItem and UITabBar
  • Index(es):
    • Date
    • Thread