1. Set the size of the Tabbaritem picture
1- (void) Configurationapptabbarandnavigationbar2 {3 //The size of the selected item normal state picture4UIImage *normalimage =Self.navigationController.tabBarController.tabBar.selectedItem.image;5UIImage *tabnormalimage = [Toolobject createnewimagewithcolor:normalimage multiple:1.1];6Tabnormalimage =[Tabnormalimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];7 [Self.navigationController.tabBarController.tabBar.selectedItem setimage:tabnormalimage];8 //Select the item to select the size of the hit image9UIImage *selectimage =Self.navigationController.tabBarController.tabBar.selectedItem.selectedImage;TenUIImage *tabselectimage = [Self createnewimagewithcolor:selectimage multiple:1.1]; OneTabselectimage =[Tabselectimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; A [Self.navigationController.tabBarController.tabBar.selectedItem setselectedimage:tabselectimage]; -Self.navigationController.tabBarController.tabBar.tintColor = [Uicolor colorwithred:0.11fGreen0.61fBlue0.97fAlpha1.00f]; -Self.navigationController.tabBarController.tabBar.barTintColor = [Uicolor colorwithred:0.85fGreen0.85fBlue0.85fAlpha1.00f]; the}
2. Image enlargement or compression processing, picture magnification 0 ~ 2, 0~1 Zoom out image
1 /**2 * Returns a zoomed-in or zoomed-out image based on image3 *4 * @param image Original Image5 * @param multiple magnification 0 ~ 26 *7 * @return A new image8 */9+ (UIImage *) Createnewimagewithcolor: (UIImage *) Image multiple: (cgfloat) MultipleTen { OneCGFloat newmultiple =multiple; A if(Multiple = =0) { -Newmultiple =1; - } the Else if((Fabs (multiple) >0&& Fabs (multiple) <1) || (Fabs (multiple) >1&& Fabs (multiple) <2)) - { -Newmultiple =multiple; - } + Else - { +Newmultiple =1; A } atCGFloat w = image.size.width*newmultiple; -CGFloat h = image.size.height*newmultiple; -CGFloat scale =[UIScreen Mainscreen].scale; -UIImage *tempimage =Nil; -CGRect ImageFrame = CGRectMake (0,0, W, h); - uigraphicsbeginimagecontextwithoptions (image.size, NO, scale); in[[Uibezierpath bezierpathwithroundedrect:imageframe Cornerradius:0] Addclip]; - [Image Drawinrect:imageframe]; toTempimage =Uigraphicsgetimagefromcurrentimagecontext (); + Uigraphicsendimagecontext (); - returnTempimage; the}
So that you can modify the selected state and the normal state of the Tabbaritem picture size, is not very simple, shortcomings, but also please give us a lot of advice
IOS uses the system's Uitabbarcontroller to modify the displayed picture size