iPhone开发--改变图片的尺寸,放大或缩小
要改变图片的尺寸,iphone中有一个很巧妙的方法,具体内容如下:
你首先建立一个新的图形环境(graphics context),在其上画一个图片(注意,图片的尺寸就是想要的尺寸)。返回的图片就是你想要的图片。代码如下:
[cpp] UIGraphicsBeginImageContext(CGSizeMake(480,320));
CGContextRef context = UIGraphicsGetCurrentContext();
[image drawInRect: CGRectMake(0, 0, 480, 320)];
UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
摘自 zcl369369的专栏
补充:移动开发 , IOS ,