gpt4 book ai didi

ios - 再现键中的比例必须与图像描述中传递的比例相匹配

转载 作者:行者123 更新时间:2023-11-29 05:33:21 26 4
gpt4 key购买 nike

iOS 上的 native 应用程序,由于这个原因我崩溃了:

scale in rendition key must match passed in scale in the image description

应用程序在模拟器上运行良好,但在设备上尝试打开模式屏幕时会崩溃。

如有任何帮助,我们将不胜感激。

最佳答案

我也遇到过这个问题。就我而言,问题是我有一个 UIButton ,其图像的比例不是 1.0。当用户点击按钮时,应用程序会因同样的原因崩溃。

事实证明,iOS 13 Beta 无法正确创建用户点击按钮时显示的图像的突出显示版本。我创建了自己的突出显示图像版本,其比例与原始图像相同,并且效果很好。

- (void)updateButtonImage:(UIImage *)image {
CGFloat heightScale = image.size.height / self.edgeLength;
CGFloat widthScale = image.size.width / self.edgeLength;
CGFloat scale = MIN(heightScale, widthScale);
[self setImage:[UIImage imageWithData:UIImagePNGRepresentation(image) scale:scale]
forState:UIControlStateNormal];
// iOS 13 beta does not properly create the highlighted image for a scaled image. This caused the
// app to crash when the user tapped the image. For now, we'll work around this by creating our
// own highlighted image and explicitly setting it on this button.
// https://feedbackassistant.apple.com/feedback/6961937
[self setImage:[UIImage imageWithData:UIImagePNGRepresentation(image.highlightedImage) scale:scale]
forState:UIControlStateHighlighted];
}

关于ios - 再现键中的比例必须与图像描述中传递的比例相匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57316368/

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