簡體   English   中英

標簽欄背景圖像透明變白

[英]Tabbar background image transparent become white

我已經通過創建背景圖片創建了自定義標簽欄,然后在我的appDelegate中使用了此代碼

UITabBar *tabBar = [UITabBar appearance];
tabBar.backgroundImage = [UIImage imageNamed:@"tabbar"];

圖片

在此處輸入圖片說明

圓形頂部周圍的顏色都是透明的,但是在應用程序中時,它會自動變成白色,因此在滾動時在桌面視圖中看起來不是很好。 我可以在iOS中保持透明嗎?

我旁邊唯一的標簽欄代碼如下

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil]
 setTitleTextAttributes:
 @{NSForegroundColorAttributeName:[UIColor whiteColor],
   NSFontAttributeName:[UIFont fontWithName:@"Lato-Regular" size:18]
   }
 forState:UIControlStateNormal];

您可以解決此問題,將選項卡欄的半透明屬性設置為false。

您可以使用情節提要中的檢查器或通過代碼進行設置:

tabBarController.tabBar.translucent = NO;

希望對您有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM