Loading载入 Lottie实作 Day31

今天要把Loading加入TableView载入之前

昨天说了动画的部分会用Lottie来做,出现阶段会是在ViewDidLoad()

那麽今天就来实作!

今天实作的路上遇到一点困难,虽然解决了但是还是莫名

前天说了新增一个Lottie,拖一个@IBOulet作为显示

但是我今天试了很多次,就是会出现Bug,都会找不到我的@IBOulet

所以我只好使用纯Programming的方式制作

这是建构出animationView
原本是使用@IBOutlet

// LoadingViewController内

override func viewDidLoad(){

let animation = AnimationView(name:"73734-logo-anmation")
animation.frame = CGRect(x:0,:y:0,width:300,height:200)
animation.center = view.center
animation.loopMode = .loop
animation.animationspeed = 1
self.view.addSubview(animation)
animation.play()
view.background = UIColor.init(white:5, alpha:0.6)

}

在要显示的VC中的ViewDidLoad()阶段

override func viewDidLoad(){
	super.viewDidLoad()
	// 使用LoadingAnimation function作为显示
	LoadingAnimation()
}
func LoadingAnimation(){
	let Loading = LoadingViewController()
	Loading.modalPresentationStyle = .overCurrentContext
	Loading.modalTransitionStyle = .crossDissove
	// 使用Present方式呈现
	// 使用tabBarController是因为这个Present stack的viewController会是tabBarController
	self.tabBarController?.present(Loading,animation: true,completion:nil)
}

成果展示:

https://i.imgur.com/ulKdpB9.gif


<<:  用 Python 畅玩 Line bot - 01:line channel 建立

>>:  Day 30 Compose UI never End

Day7 - 程序设计报价 (二) - 重新定义甲乙关系

从传统的接案甲乙方关系我们发现,因为利益的冲突,甲方也不可能得到乙方 100% 的专业协助,因为乙方...

【Day 03】- Python 基础操作与常见资料型态(整数、浮点数、布林值、字串、串列、元组、字典)

前情提要 在前一篇文章内容中带大家建立了 pipenv 虚拟环境,并在虚拟环境中装了套件。又安装了 ...

Day27 - this&Object Prototypes Ch3 Objects - Review

Obgect content Getter 与 Setter : 他们是 Object 内建的 p...

Day23 | Livewire 实作 购物网站(二): 建立商品细节页面

有了商品列表,那应该要能点进去看商品的细节吧。所以今天就是来做点进去後的商品细节页! 今日目标:商品...

【Day18】Uart_TX 的实现

既上一篇我们设计了 Uart_TX 的状态机,我们今天要来引用状态机模块来实现这个 Uart_TX ...