1.去除图片的系统默认渲染

  选中图片,设置属性Render As为Original Image

代码控制:

#import <UIKit/UIKit.h>

@interface UIImage (HKExtension)

@property(nonatomic,strong,readonly)UIImage * resizbleImage;

@property(nonatomic,strong,readonly)UIImage * originarImage;

+(UIImage *)hk_resizbleImage:(NSString *)name;

+(UIImage *)imageWithOriginalNamed:(NSString *)name ;

+(UIImage *)hk_imageWithOriginalNamed:(NSString *)name;

@end

 

#import "UIImage+HKExtension.h"

 

@implementation UIImage (HKExtension)

//不被渲染

-(UIImage *)originarImage

{

    return [self imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

}

+(UIImage *)hk_imageWithOriginalNamed:(NSString *)name

{

    UIImage * image = [UIImage imageNamed:name];

    return  [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

}

//不被渲染

+(UIImage *)imageWithOriginalNamed:(NSString *)name

{

    UIImage * image = [UIImage imageNamed:name];

    return  [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

}

//保护四周 拉伸中间一个像素点

+(UIImage *)hk_resizbleImage:(NSString *)name

{

    UIImage * image = [UIImage imageNamed:name];

    return [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5];

}

 @end

2.去除文字渲染

 //设置应用程序中所有的UITabBarItem的属性

    UITabBarItem * item = [UITabBarItem appearance];//认为是一个皮肤

    //属性字典

    NSDictionary * dict = @{

                            NSFontAttributeName : [UIFont systemFontOfSize:12],

                            NSForegroundColorAttributeName : [UIColor grayColor]

                            };

    NSDictionary * dictSelect = @{ NSForegroundColorAttributeName : [UIColor darkGrayColor]};

    

    [item setTitleTextAttributes:dict forState:UIControlStateNormal];

    [item setTitleTextAttributes:dictSelect forState:UIControlStateSelected];

 注意:文字在选中状态下字体大小设置没有用,文字大小只能在normal状态下设置