ios 設置tabBarItem.selectedImage圖片無效


今天遇到個小問題:項目中要做一個 換膚的效果(就是點擊換膚改變tabbarItem的圖片)但是通過斷點能看到圖片確實變了 ,但是界面的樣式沒變。如下:

結果界面上tabbar的圖片就是沒變化

查了下 image的幾個樣式

  1. typedef NS_ENUM(NSInteger, UIImageRenderingMode) {  
  2.     UIImageRenderingModeAutomatic,          // Use the default rendering mode for the context where the image is used  
  3.       
  4.     UIImageRenderingModeAlwaysOriginal,     // Always draw the original image, without treating it as a template  
  5.     UIImageRenderingModeAlwaysTemplate,     // Always draw the image as a template image, ignoring its color information  
  6. } NS_ENUM_AVAILABLE_IOS(7_0);  

改成了用UIImageRenderingModeAlwaysOriginal渲染就可以了

總結如果 遇到給某個空間賦值圖片打不到預想的效果嘗試改變渲染方式為原樣試試。。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM