I have an UITabBar and set 2 images for a tab(active item, deactive item). On deactive item tab icon shown properly as:
but when those item is active, icon not shown properly:
Can anyone help me to fix it? I was that it will colour just borders of the icon, not entirely
You need to use UIImageRenderingMode for that.
UIImage *imgNormal=[UIImage imageNamed:@"normal.png"];
imgNormal=[imgNormal imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage *imgSelected=[UIImage imageNamed:@"active.png"];
imgSelected=[imgSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tabBarItem.image = imgNormal;
tabBarItem.selectedImage = imgSelected;
Hope it helps :).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.