【问题标题】:Cannot convert value of type 'NSImageInterpolation.Type' to expected argument type '[NSImageRep.HintKey : Any]?'无法将类型“NSImageInterpolation.Type”的值转换为预期的参数类型“[NSImageRep.HintKey: Any]?”
【发布时间】:2020-07-16 19:58:20
【问题描述】:

我想根据https://stackoverflow.com/a/14878177/848968添加图像插值提示

 guard let representation = self.bestRepresentation(for: frame, context: nil,hints: NSImageInterpolation) else {
            return nil

但我不断收到这个异常

Cannot convert value of type 'NSImageInterpolation.Type' to expected argument type '[NSImageRep.HintKey : Any]?'

【问题讨论】:

  • 错误很明显hints: [.interpolation: NSImageInterpolation.high.rawValue]
  • @LeoDabus 谢谢.. 你能把它添加为答案吗?你能帮我解决这个问题吗stackoverflow.com/questions/61030581/…

标签: swift macos cocoa swift4


【解决方案1】:

这个错误很容易解释。

guard let representation = self.bestRepresentation(for: frame,
                                                   context: nil,
                                                   hints: [.interpolation: NSImageInterpolation.high])
else { return nil }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-18
    • 1970-01-01
    • 1970-01-01
    • 2020-02-04
    • 2018-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多