ios – 使用CIFilter时为什么模拟器速度很慢

前端之家收集整理的这篇文章主要介绍了ios – 使用CIFilter时为什么模拟器速度很慢前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用CIFilter创建图像过滤器并在图像视图上显示它.它发生的事情是它在 iphone设备上工作正常,但在模拟器上运行速度很慢.下面是代码.我徘徊为什么模拟器比设备慢.有没有办法增加模拟器内存​​或cpu,以使其像设备一样工作?

func outputImage(filter: CIFilter,originalImage: UIImage) -> UIImage{
    print(filter)
    let inputImage = CIImage(image: originalImage)
    filter.setValue(inputImage,forKey: kCIInputImageKey)
    let outputImage =  filter.outputImage
    let cgImage = context!.createCGImage(outputImage!,fromRect: (outputImage?.extent)!)
    return UIImage(CGImage: cgImage,scale: 1,orientation: originalImage.imageOrientation)
}

解决方法

检查调试 – >切换慢动画未经检查您可能会意外检查,这也是性能的原因.

猜你在找的Xcode相关文章