When doing the project, assume that when using the system's Uitabbarcontroller, the bottom tab itself defines the picture to be blue and gray. This is not the effect we want.
Suppose you want to display your own defined, pressed and bouncing picture effects. At this time, the Tabbaritem needs to be changed.
Here is a detailed demo sample:
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++;
}
}
Swift development Tutorial--How to define your own Tabbaritem image display