我在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
感謝您的回覆我完成了它。 –