LoginSignup
0
1

More than 3 years have passed since last update.

Present Modallyをdismissした時に遷移前の画面を更新する

Last updated at Posted at 2020-06-23

備忘録

ios13以降で画面遷移をPresent Modallyにした場合、dismissした時に遷移前の画面が更新されないので、対処法を残しておきます。

対処法1

PresentationをfullScreenにする

Screen Shot 2020-06-23 at 15.52.08.png

対処法2

extension 遷移前ViewControler: UIAdaptivePresentationControllerDelegate {
    func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
        tableView.reloadData()
    }
}
extension 遷移後ViewController {

    override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
        super.dismiss(animated: flag, completion: completion)
        guard let presentationController = presentationController else {
            return
        }
        presentationController.delegate?.presentationControllerDidDismiss?(presentationController)
    }

}

最後に

初心者のため、間違っている可能性があります。
参考までによろしくお願いします。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1