相关疑难解决方法(0)

LottieAnimationView 大小不会改变/太小(iOS/Swift)

无论我创建的视图是 LOTAnimatedSwitch 还是 View,动画的图像总是显得很小。lottie 动画不占用我创建的视图的大小。这是从 LottieFiles 下载动画的问题吗?文件的尺寸为 600x600 像素。我使用的是 Lottie 版本 2.5.0 和 Swift 4。例如:

在此处输入图片说明

    let animatedSwitch = LOTAnimatedSwitch(named: "toggle_switch")
    animatedSwitch.frame.origin = CGPoint(x: 8, y: separatorLineView.frame.height + separatorLineView.frame.origin.y + 8)
    animatedSwitch.frame.size = CGSize(width: dialogViewWidth - 16, height: 40)
    animatedSwitch.setProgressRangeForOnState(fromProgress: 0.5, toProgress: 1)
    animatedSwitch.setProgressRangeForOffState(fromProgress: 0, toProgress: 0.5)
    animatedSwitch.contentMode = .scaleAspectFill
    animatedSwitch.clipsToBounds = true
    animatedSwitch.backgroundColor = .purple
Run Code Online (Sandbox Code Playgroud)

swift lottie

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

lottie ×1

swift ×1