What size should TabBar images be?
According to the Apple Human Interface Guidelines: @1x : about 25 x 25 (max: 48 x 32) @2x : about 50 x 50 (max: 96 x 64) @3x : about 75 x 75 (max: 144 x 96)
According to the Apple Human Interface Guidelines: @1x : about 25 x 25 (max: 48 x 32) @2x : about 50 x 50 (max: 96 x 64) @3x : about 75 x 75 (max: 144 x 96)
There’s a project on github called BCTabBarController that aims to mimic the tab bar used in Twitter for iPhone. It’s got some of the things you’re looking for, and should give a great starting point.
There are two things you need to do for this: 1) If you want to customize the TabBar itself, you need to set the barTintColor for the tabBarController: // this will generate a black tab bar tabBarController.tabBar.barTintColor = [UIColor blackColor]; // this will give selected icons and text your apps tint color tabBarController.tabBar.tintColor = appTintColor; … Read more
From UITabBarItem class docs: By default, the actual unselected and selected images are automatically created from the alpha values in the source images. To prevent system coloring, provide images with UIImageRenderingModeAlwaysOriginal. The clue is not whether you use UIImageRenderingModeAlwaysOriginal, the important thing is when to use it. To prevent the grey color for unselected items, … Read more
Thats because UIBarButtonItem image’s default rendering mode always draw the image as a template image, ignoring its color information (UIImageRenderingModeAlwaysTemplate). Just create your image using UIImage’s method imageWithRenderingMode always original. UIImage(named: “yourImageName”)!.withRenderingMode(.alwaysOriginal)
I am maintaining a large iPad app written mostly in Objective-C that has survived several iOS releases. I ran into the situation where I needed the pre-iOS 11 tab bar appearance (with the icons above the titles instead of next to them) for a couple tab bars. My solution was to create a subclass of … Read more
I recommend a better way: [yourTabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], UITextAttributeTextColor, [NSValue valueWithUIOffset:UIOffsetMake(0,0)], UITextAttributeTextShadowOffset, [UIFont fontWithName:@”Helvetica” size:18.0], UITextAttributeFont, nil] forState:UIControlStateNormal];
In your tabBarController, you can set the default UITabBar tintColor, barTintColor, selectionIndicatorImage (cheating a bit here) and renderingMode of the images, see comments below: class MyTabBarController: UITabBarController, UINavigationControllerDelegate { … override func viewDidLoad() { … // Sets the default color of the icon of the selected UITabBarItem and Title UITabBar.appearance().tintColor = UIColor.redColor() // Sets the … Read more
You can also set the property Render As of your tab bar images within your asset catalog directly. There you have the option to set the property to Default, Original Image and Template Image.
Apple added tab bar customization in iOS 5, and now this kind of stuff is trivial. Prior to this it was a huge hack, and not recommended. Here’s how to do a completely custom tab bar: // custom icons UITabBarItem *item = [[UITabBarItem alloc] init]; item.title = @”foo”; // setting custom images prevents the OS … Read more