私のMainViewControllerに2 ViewControllers
が2つあり、SecondViewControllerにsegueを実行するボタンがあります。ボタンをタップすると、初期データをcoreDataに保存しているので、時間がかかります。View Controller間を通過する際にアクティビティインジケータを表示する方法
ここに私がしたいことがあります。 ViewControllersの間を渡している間に、ActivityIndicator
を表示したいが、SecondViewControllerを開いた後に開始する。私たちを手伝ってくれますか?私はスウィフトの新人です。ここで
は私MainVCで使用されるコードです:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "SecondViewController") {
SwiftSpinner.show("Loading") // Act. indicator found on github
willRunOnce() // Here Im saving data to CoreData
SwiftSpinner.hide()
}
}
あなたはボタンのクリックでスピナーを示さなければならないとした後、それを隠す必要があります 'prepareForSegue' – Aditya