我在UITabBarController
中工作,当我要为选项卡设置图像时,视图打开时图像不会第一次出现。我不知道如何解决这个问题。如何在uitabbaritem中设置默认图像
这是我使用的代码:
UIImage *prfimage = [UIImage imageNamed:@"profile_o.png"];
UIImage *selimage = [UIImage imageNamed:@"profile_o.png"];
UITabBarItem *tbP = [[UITabBarItem alloc] initWithTitle:@"" image:prfimage tag:YES];
[self setTabBarItem:tbP];
[[UITabBar appearance] setTintColor:[UIColor colorWithRed:247/255.0f green:148/255.0f blue:29/255.0f alpha:2.0f]];
self.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
self.title = nil;
请参阅此链接设置选项卡图像。 http://stackoverflow.com/questions/33366425/how-to-change-the-tab-bar-image-color-for-selected-and-unselected/33366626#33366626 – VRAwesome
感谢您的回复我完成了它。 –