简体   繁体   中英

How to resize image with aspect ratio?

this is my code:-

(UIImage*)imageWithImage:(UIImage*)image 
              scaledToSize:(CGSize)newSize;
{        
    UIGraphicsBeginImageContext( newSize );
    [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return newImage;
}

使用网站上的类别文件来调整UIImage的大小:

Look this Qus , may be helped you...

Resize UIImage with aspect ratio?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM