请问大家有发现svga添加在window上加载不出来的情况
Opened this issue · 2 comments
Legendgp commented
Attention
- Do not ask any usage question, issue board is a issue board, accept library bugs only.
- If you are facing any usage problem, read the README again.
Issue Template
Issue Description(What's your problem)
How To Reappear(How to reappear the issue)
Any Attachment(Provide a sample about your issue)
------ 中文分割线 ------
注意
- 不要在 Issue 板块提问使用问题,Issue 板块只接受 Bug 反馈。
- 如果遇到使用上的问题,仔细阅读 README。
Issue 模板
请尽量使用英文提交 Issue
请确切回答:问题的描述、重现方式、附件(提供一个 Demo 以重现问题)
yangqingren commented
你好,请提供相应的代码片段和 svga 素材
Legendgp commented
你好,烦劳测试
代码如下:
import UIKit
class TestViewController: UIViewController {
lazy var player: SVGAPlayer = {
let player = SVGAPlayer.init(frame: CGRect.init(x: 100, y: 200, width: 200, height: 108))
player.isUserInteractionEnabled = true
let parser = SVGAParser.init()
let url = NSURL.fileURL(withPath: Bundle.main.path(forResource: "starlight", ofType: "svga")!)
parser.parse(with: url) { [weak self] videoItem in
guard let self = self else { return }
self.player.videoItem = videoItem
self.player.startAnimation()
} failureBlock: { error in}
return player
}()
override func viewDidLoad() {
super.viewDidLoad()
//view.window?.addSubview(player)//window上无法加载出svga文件
view.addSubview(player)//view上可以加载出来
}
}