2017-11-11 152 views
0

我試圖在iOS上使用FBShimmer可可豆莢但未找到Foundation框架。 PodFile shown here試圖在iOS上使用FBShimmer可可豆莢但未找到Foundation框架

enter image description here

enter image description here

+0

嘗試取消註釋use_frameworks!從您的podfile中,然後再次安裝。它可能有幫助。 –

+0

https://stackoverflow.com/questions/24750593/unknown-type-name-cgfloat-when-try-to-add-panoramagl-to-the-static-library/27902361 –

+0

@AaqibHussain我試過,但然後標題沒有找到橋接頭中列出的文件。 –

回答

0

最後我只使用一個UIView擴展達到同樣的效果。更少的代碼和外部依賴。

func startShimmering() { 
    let light = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5).cgColor 
    let dark = UIColor.white.cgColor 

    let gradient: CAGradientLayer = CAGradientLayer() 
    gradient.colors = [dark, light, dark] 
    gradient.frame = CGRect(x: -self.bounds.size.width, y: 0, width: 3*self.bounds.size.width, height: self.bounds.size.height) 
    gradient.startPoint = CGPoint(x: 0.0, y: 0.4) 
    gradient.endPoint = CGPoint(x: 1.0, y: 0.5) 
    gradient.locations = [0.4, 0.5, 0.6] 
    self.layer.mask = gradient 

    let animation: CABasicAnimation = CABasicAnimation(keyPath: "locations") 
    animation.fromValue = [0.0, 0.1, 0.2] 
    animation.toValue = [0.8, 0.9, 1.0] 

    animation.duration = 3.0 
    animation.repeatCount = HUGE 
    gradient.add(animation, forKey: "shimmer") 


}