UIImage类型的值没有成员dominantColors

问题描述:

因此,我已经安装了一个名为'KTSpectrum'的库,我在图像上调用一个扩展dominantColors以返回一个UIColor对象。UIImage类型的值没有成员dominantColors

import KTSpectrum // this import the kMeans clustering library 

@IBOutlet var tempImageView: UIImageView! // this hold a temporary image to be displayed in the view 

let image = UIImage(CGImage: cgImageRef!, scale: 1.0, orientation: UIImageOrientation.Right) 

self.tempImageView.image = image 
self.tempImageView.hidden = false 

let colors = self.tempImageView.image!.dominantColors() 
// this gives me the error Value of type UIImage has no member dominantColors 

我已经链接了框架并将其构建在项目中。仍然不确定错误告诉我什么。

+0

plz告诉我们链接到KTSpectrum –

+0

你是什么意思的链接? https://github.com/kylry/KTSpectrum – user3288619

+0

根据文档,我已经完成了我需要的一切。其他有类似错误的用户表示需要解开图像等,等等。 – user3288619

只需将文件直接复制到您的项目:

  • kMeans.swift
  • 频谱+ UIImage.swift
  • SpectrumDataTypes.swift
  • SpectrumSettings.swift

和唐不使用CocoaPods。你不必使用“import KTSpectrum”行,一切都会正常工作,我只是自己试了一下。

+0

好的,谢谢,我只是喜欢用CocoaPods让所有东西看起来像清洁器。 – user3288619