Detect when a tab bar item is pressed

You don’t want your view controller’s base class to be a UITabBarDelegate. If you were to do that, all of your view controller subclasses would be tab bar delegates. What I think you want to do is to extend UITabBarController, something like this: class MyTabBarController: UITabBarController, UITabBarControllerDelegate { then, in that class, override viewDidLoad and … Read more

Changing font size of tabbaritem

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];

IOS 8 Tab Bar Item Background Colour

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

How to change the Color of text in UITabBarItem in iOS 5

Do you mean this one? Keep in mind, this only works for iOS5.0 or later. if ([self.tabBarItem respondsToSelector:@selector(setTitleTextAttributes:)]) { NSLog(@”*** Support method(iOS 5): setTitleTextAttributes:”); [self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@”AmericanTypewriter” size:20.0f], UITextAttributeFont, [UIColor blackColor], UITextAttributeTextColor, [UIColor grayColor], UITextAttributeTextShadowColor, [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset, nil]]; } Apple’s documentation on customizing appearance: In iOS v5.0 and later, you can … Read more

UITabBar not showing selected item images in ios 7

You need to use tabBarItem initWithTitle:image:selectedImage [[UITabBarItem alloc] initWithTitle:@”title” image:image selectedImage:imageSel]; in conjunction with changing the UIImage rendering mode: imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal or (to apply parent views template tint mask, this option is default for Tab bar Items unless you opt out with the above rendering mode) imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate here is a code sample for one tab bar … Read more

iOS 11 iPhone X simulator UITabBar icons and titles being rendered on top covering eachother

I was able to get around the problem by simply calling invalidateIntrinsicContentSize on the UITabBar in viewDidLayoutSubviews. -(void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self.tabBar invalidateIntrinsicContentSize]; } Note: The bottom of the tab bar will need to be contained to the bottom of the main view, rather than the safe area, and the tab bar should have no … Read more