iOS removes the default image and text rendering of the system

Source: Internet
Author: User

1. System default rendering of image removal

Select the picture, set the property to render as original image

Code Control:

#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)

not be rendered

-(UIImage *) originarimage

{

return [self imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];

}

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

{

UIImage * image = [UIImage imagenamed:name];

return [Image imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];

}

not be rendered

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

{

UIImage * image = [UIImage imagenamed:name];

return [Image imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];

}

Protect the surrounding stretch by one pixel point

+ (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. Remove text rendering

Set the properties of all Uitabbaritem in the application

Uitabbaritem * item = [Uitabbaritem appearance];//thought to be a skin

Property dictionary

Nsdictionary * Dict = @{

Nsfontattributename: [Uifont systemfontofsize:12],

Nsforegroundcolorattributename: [Uicolor Graycolor]

};

Nsdictionary * Dictselect = @{nsforegroundcolorattributename: [Uicolor Darkgraycolor]};

[item settitletextattributes:dict Forstate:uicontrolstatenormal];

[item Settitletextattributes:dictselect forstate:uicontrolstateselected];

Note: The font size setting is not used when the text is selected, and the text size can only be set in the normal state

iOS removes the default image and text rendering of the system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.