At the time of the project, if the Uitabbarcontroller of the system is used, the tab custom image at the bottom is blue and gray, which is not the effect we want.
If you want to display a custom pressed and bounced picture effect, you need to modify the Tabbaritem.
Here is a concrete example:
var itemnamearray:[String] = ["down_32","add_32", "Plane_32" , "Circle_32" ]
var itemnameselectarray:[String] = ["down_click_32","Add_click_32" ,"plane_click_32","circle_click_32"]
func Configtabbar () {
var count:Int =0;
let items =self. TabBar . Items
for item in items as! [uitabbaritem] {
var Image:UIImage =UIImage(named: itemnamearray[count])!
var selectedimage:UIImage =UIImage(named: I Temnameselectarray[count])!;
image = image. Imagewithrenderingmode (uiimagerenderingmode. alwaysoriginal );
selectedimage = selectedimage. Imagewithrenderingmode (uiimagerenderingmode. alwaysoriginal );
Item. SelectedImage = SelectedImage;
Item. Image = image;
count++;
}
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Swift development Tutorial--How to customize the Tabbaritem image display