2017-11-11 38 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") 


} 
相关问题