摘要: UIImage *srcimg = [UIImage imageNamed:@"test.png"];////test.png宽172 高192 NSLog(@"image width = %f,height = %f",srcimg.size.width,srcimg.size.height); UIImageView *imgview = [[UIImageView alloc] init]; imgview.frame = CGRectMake(10, 150, 300, 220); CGRect rect = CGRectMake(0, 0, 300, 100);//要裁剪的图片区域,按照原图的像素大小来,超过原图大小的边自动适配 CGImageRef cgimg = CGImageCreateWithImageInRect([srcimg CGImage], rect); imgview.image = [UIImage imageWithCGImage:cgimg]; CGImageRelease(cgimg);//用完一定要释放,否则内存泄露 [self 阅读全文
posted @ 2012-07-27 14:31 苹果吧 阅读(9298) 评论(0) 推荐(1) 编辑