swift - 无法将“NSImageInterpolation.Type”类型的值转换为预期的参数类型“[NSImageRep.HintKey: Any]?”
问题描述
我想根据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]?'
解决方案
错误是非常不言自明的。
guard let representation = self.bestRepresentation(for: frame,
context: nil,
hints: [.interpolation: NSImageInterpolation.high])
else { return nil }
推荐阅读
- vue.js - 如何捕获一个空的 Vuex Store 状态但在初始化时有一个计算属性对其做出反应
- javascript - 如何在javascript中过滤和创建响应
- css - 使用来自另一个文件的 SCSS 值
- youtube-iframe-api - youtube-iframe-api 显示 iframe 中某些视频的视频不可用
- azure-active-directory - 是否可以通过服务主体/应用注册从 Sql Server Management Studio 连接到 Azure Sql 数据库?
- python - 将 df.iloc 与变量一起使用
- regex - 流畅的解析
- python - Django 错误 PermissionDenied 没有属性 set_cookie
- python - 在 KivyMD 中创建多个 ILeftBodyTouch 项目
- netsuite - NetSuite 在 Onchange“行项目”期间获取描述并设置税金