gpt4 book ai didi

iphone - 替代 UIImage 的 imageWithCGImage :scale:orientation:

转载 作者:搜寻专家 更新时间:2023-10-30 19:46:48 25 4
gpt4 key购买 nike

我为 4.x 构建了一个应用程序,应该为所有 iPhone 3.0-4.x 部署。我意识到 imageWithCGImage:scale:orientation 方法仅在 4.0 及更高版本中可用。 3.x 的任何替代方案?供引用:

Creates and returns an image object with the specified scale and orientation factors.
+ (UIImage *)imageWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation

我目前的使用情况:

UIImage *inputImage = [UIImage imageWithCGImage:[[UIImage imageNamed: @"arrow.png"] CGImage] scale:1.2 orientation:UIImageOrientationUp];

比例是静态的(即我从不改变它)所以我可能会通过 photoshop 来缩放图像,但方向在我的应用程序中仍然是必需的。

谢谢!

最佳答案

您可以使用 CGContext 函数进行缩放、旋转(平移)。然后你可以使用...

CGImageRef CGBitmapContextCreateImage (
CGContextRef c
);

+ (UIImage *)imageWithCGImage:(CGImageRef)cgImage

关于iphone - 替代 UIImage 的 imageWithCGImage :scale:orientation:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6882789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com