UIImage Setting the rendering mode

Source: Internet
Author: User

When using the system Tabbar to add pictures, the picture will be blurred, modify the size of the picture is not good, and later found the concept of rendering, the clues to find the Imagewithrenderingmode this method.

UIImage Remove rendering can only be used in IOS7 or above systems

UIImage *img = [UIImage imagename:@ "xxxx"];

img= [img imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];

This will solve the problem of blurred images, but also can solve the Tabbar default selected color.

Set the rendering mode for UIImage: Uiimage.renderingmode

Coloring (Tint color) is one of the iOS7 interfaces. Set the rendering mode of the UIImage: Uiimage.renderingmode A significant change, you can set a UIImage Color to use the current view when rendering. UIImage added a read-only property: Renderingmode, corresponding to a new method: Imagewithrenderingmode:, It uses the Uiimagerenderingmode enumeration value to set the Renderingmode property of the picture.   The enumeration contains the following values: Uiimagerenderingmodeautomatic//automatically adjusts the rendering mode based on the environment in which the picture is used and the drawing context in which it is located.   Uiimagerenderingmodealwaysoriginal//Always draws the original state of the picture without using tint Color. Uiimagerenderingmodealwaystemplate//Always draws a picture based on tint color, ignoring the color information of the picture.

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.