我正在使用下面的代码转换黑白图像。它工作得很好。但是我改变了图像的亮度和对比度。应用程序仅在iOS 6.0上崩溃。我使用的是不推荐使用的方法吗?请帮帮我。使用此链接https://github.com/esilverberg/ios-image-filters更改亮度和对比度
- (UIImage *)convertImageToGrayScale:(UIImage *)image
{
CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
CGContextRef context = CGBitmapContextCreate(nil, image.size.width, image.size.height, 8, 0, colorSpace, kCGImageAlphaNone);
CGContextDrawImage(context, imageRect, [image CGImage]);
CGImageRef imageRef = CGBitmapContextCreateImage(context);
UIImage *newImage = [UIImage imageWithCGImage:imageRef];
CGColorSpaceRelease(colorSpace);
CGContextRelease(context);
CFRelease(imageRef);
return newImage;
}提前谢谢。
发布于 2012-09-24 14:00:40
检查以下链接以获取不推荐使用的方法的列表
https://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/_index.html
http://www.bgr.com/2012/07/16/ios-6-download-beta-3-change-log/
https://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-Xcode/_index.html
https://stackoverflow.com/questions/12559595
复制相似问题