我正在自定义我的 TabBar 图标,但我遇到了自定义选项卡图形在第一次单击时才显示的问题,但第一个选项卡除外。设置如下Entry->VC->Tab Controller->TabVC1->TabVC2->TabVC3->TabVC4->TabVC5。让它们在标签控制器的第一次初始化时出现的最佳方法是什么。
** 这些属性是在我进入选项卡控制器时设置的(它们工作正常)
// Set background to white for the tab bar
UIImage *tabBackground = [[UIImage imageNamed:@"tabback.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UITabBar appearance] setBackgroundImage:tabBackground];
// setting the selected color to blue
self.tabBar.tintColor = [UIColor blueColor];
// changing the tab bar text color
[[UITabBarItem appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor], UITextAttributeTextColor,[UIFont fontWithName:@"Copperplate-Bold" size:0.0], UITextAttributeFont, nil] forState:UIControlStateNormal];
** 这些是在单独的 TabVC 中设置的(它们仅在第一次单击其选项卡后显示)
// loading the custom icon for front and back
UITabBarItem *tabicon = [[UITabBarItem alloc] initWithTitle:@"Daily" image:[UIImage imageNamed:@"Day.png"] tag:0];
[tabicon setFinishedSelectedImage:[UIImage imageNamed:@"Day.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"Day.png"]];
[self setTabBarItem:tabicon];