Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UItabbar item not showing storyboard reference

I'm trying to use the new storyboard references in a tabbar. When I use the storyboard reference, the UITabBarItem (with customized image & text set), isn't showing anything. See setup: storyboard setup

tabbaritem setup

I fixed it for now by setting the images & title in the initWithCoder function for the initial viewcontroller in the referenced storyboards like so:

static NSString *const ContactsViewControllerTabContactImageName = @"tab-contact"; static NSString *const ContactsViewControllerTabContactActiveImageName = @"tab-contact-active";  - (instancetype)initWithCoder:(NSCoder *)aDecoder {     self = [super initWithCoder:aDecoder];     if (self) {         self.title = NSLocalizedString(@"Contacts", nil);         self.tabBarItem.image = [UIImage imageNamed:ContactsViewControllerTabContactImageName];         self.tabBarItem.selectedImage = [UIImage imageNamed:ContactsViewControllerTabContactActiveImageName];     }     return self; } 
like image 948
Bob Voorneveld Avatar asked Nov 17 '15 10:11

Bob Voorneveld


1 Answers

You need to add the tab bar item in the destination storyboard view controller.

Interface Builder View of Destination Storyboard

like image 189
leogdion Avatar answered Oct 09 '22 22:10

leogdion