私のアプリケーションでは、特定の機能の使用方法に関する非常に基本的なチュートリアルとして役立つ新しいストーリーボードを作成しました。 (Instructions.storyboard)。このストーリーボードには独自のクラスがあります - InstructionsVC.swiftViewDidAppearを使用してView Controllerを表示し、終了時に再び開く
MainVCがviewDidAppear内に読み込まれたときに、InstructionsVCを表示します。
素晴らしいです。アプリロード時に発生するように起動します。この問題は、命令インタフェースの[閉じる]ボタンを押すと発生します。それは、VCを閉じ、メイン画面にフェードアウトし、すぐに命令VCを起動します。
命令VCの終了後に命令VCの読み込みが再開されないようにするにはどうすればよいですか?
func openInstructions() {
let storyboard = UIStoryboard(name: "Instructions", bundle: nil)
let instructionsView = storyboard.instantiateViewController(withIdentifier: "instructionsStoryboardID")
instructionsView.modalPresentationStyle = .fullScreen
instructionsView.modalTransitionStyle = .crossDissolve
self.present(instructionsView, animated: true, completion:nil)
}
override func viewDidAppear(_ animated: Bool) {
openInstructions()
}
そして、私の指示のクラス内で、私は閉じるボタンで次のアクションを持っている:
@IBAction func closeButtonPressed(_ sender: UIButton) {
let presentingViewController: UIViewController! = self.presentingViewController
presentingViewController.dismiss(animated: true, completion: nil)
}
注 - 私はするつもりですので、私はむしろ、これを解決するためにUserDefaultsを使用していないと思いますAppの他の部分と同様のものを組み込むことができ、望ましい動作を実現するためにUserDefaultsに頼らざるをえない。
おかげさまで前もって仲間!
ありがとうございました!そのソリューションは完璧に機能しました。 – Joe