动画不在ios游乐场工作

动画不在ios游乐场工作,第1张

概述这是我的动画方法(PreloaderView. swift) public func performAction(action: PreloaderAction){ let highOpacity = CABasicAnimation.init(keyPath: "opacity") let middleOpacity = CABasicAnimation.init(keyPat 这是我的动画方法(PreloaderVIEw. swift)

public func performAction(action: PreloaderAction){    let highOpacity = CABasicAnimation.init(keyPath: "opacity")    let mIDdleOpacity = CABasicAnimation.init(keyPath: "opacity")    let lowOpacity = CABasicAnimation.init(keyPath: "opacity")    if action == .PreloaderActionNone {        self.thirdShape.removeAllAnimations()        self.firstShape.opacity = 0.3;        self.secondShape.opacity = 0.5        self.thirdShape.opacity = 1.0    } else if action == .PreloaderActionFailure {        UIVIEw.animateWithDuration(2,animations: {            self.thirdShape.strokecolor = UIcolor.redcolor().CGcolor        }) {(completed : Bool) in            self.thirdShape.strokecolor = self.ringcolor.CGcolor        }    }    if action == .PreloaderActionStart {        highOpacity.fromValue = 0.0        highOpacity.tovalue = 1.0        highOpacity.duration = animationDuration        highOpacity.autoreverses = true        highOpacity.repeatCount = .infinity        self.secondShape.addAnimation(highOpacity,forKey: "highOpacity")        mIDdleOpacity.fromValue = 0.0        mIDdleOpacity.tovalue = 1.0        mIDdleOpacity.duration = animationDuration        mIDdleOpacity.autoreverses = true        mIDdleOpacity.repeatCount = .infinity        mIDdleOpacity.beginTime = CACurrentMediaTime() + 0.33        self.firstShape.addAnimation(mIDdleOpacity,forKey: "mIDdleOpacity")        lowOpacity.fromValue = 0.0        lowOpacity.tovalue = 1.0        lowOpacity.duration = animationDuration        lowOpacity.autoreverses = true        lowOpacity.beginTime = CACurrentMediaTime() + 0.66        lowOpacity.repeatCount = .infinity        self.thirdShape.addAnimation(lowOpacity,forKey: "lowOpacity")    }}

这是我的游乐场文件

和项目导航器中的游乐场

动画在设备上运行良好,但是当我使用游乐场动画时无法正常工作.

解决方法 Xcode 7,Swift 2

import XCPlayground

在游乐场的顶部,然后使用

XCPlaygroundPage.currentPage.liveVIEw = vIEw

在Playground的底部,其中视图是您要渲染的视图.

您还必须打开“助理编辑器”(在“视图”菜单中)才能看到当前的实时视图.

此外,如果您正在使用异步 *** 作,则必须包括

XCPlaygroundPage.currentPage.needsIndefiniteExecution = true

为了在游乐场中使用它们.

Xcode 8,Swift 3

import PlaygroundSupportPlaygroundPage.current.needsIndefiniteExecution = truePlaygroundPage.current.liveVIEw = vIEw
总结

以上是内存溢出为你收集整理的动画不在ios游乐场工作全部内容,希望文章能够帮你解决动画不在ios游乐场工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1059319.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存