码迷,mamicode.com
首页 > 其他好文 > 详细

自带TabBar选中图片设置问题

时间:2015-10-14 21:26:14      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

 

 

设置为UIImageRenderingModeAlwaysOriginal 

就会显示出选中状态的图片。当然普通状态的也需要设置。

 UINavigationController *nav =({

        

        UINavigationController *controller = [[UINavigationController alloc]initWithRootViewController:rootVC];

        [controller.tabBarItem setTitle:title];

        UIImage *selectImage = ({

            UIImage *image = [UIImage imageNamed:selectString];

    UIImageRenderingModeAutomatic,          // Use the default rendering mode for the context where the image is used

    UIImageRenderingModeAlwaysOriginal,     // Always draw the original image, without treating it as a template

    UIImageRenderingModeAlwaysTemplate,     // Always draw the image as a template image, ignoring its color 

            image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

            image;

        });

        [controller.tabBarItem setSelectedImage:selectImage];

        [controller.tabBarItem setImage:[UIImage imageNamed:normalString]];

        controller;

    });

自带TabBar选中图片设置问题

标签:

原文地址:http://www.cnblogs.com/XHShare/p/4878473.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!