2016-05-15 102 views
0

因此,我已經安裝了一個名爲'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

回答

1

只需將文件直接複製到您的項目:

  • kMeans.swift
  • 頻譜+ UIImage.swift
  • SpectrumDataTypes.swift
  • SpectrumSettings.swift

和唐不使用CocoaPods。你不必使用「import KTSpectrum」行,一切都會正常工作,我只是自己試了一下。

+0

好的,謝謝,我只是喜歡用CocoaPods讓所有東西看起來像清潔器。 – user3288619

相關問題