IOS resize picture, tell your UI, don't ask me size! I want the biggest.

Source: Internet
Author: User

If the UI asks you "How big is this picture?" "And how should you answer?"

In order not to allow the image to be deformed or blurred due to stretching or compression, please tell the image of the image of the proportion, as for the resolution of the picture, not necessarily too strict, but the minimum requirement is to make the largest screen does not appear the situation described above, the other to the following methods to deal with it.

Again, picture proportions must be accurate!

The following are the common sizes of iOS phones:

Photo Excerpt from here

Next is the method of processing:

-(UIImage *) Imagewithimagesimple: (UIImage *) image scaledtosize: ( cgsize) newsize{    uigraphicsbeginimagecontext (newSize);    [Image Drawinrect:cgrectmake (0 ,0  , Newsize.width, Newsize.height)];     * NewImage = uigraphicsgetimagefromcurrentimagecontext ();    Uigraphicsendimagecontext ();     return newimage;}

IOS resize picture, tell your UI, don't ask me size! I want the biggest.

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.