LoginSignup
2
2

More than 3 years have passed since last update.

UIViewControllerのアニメーション無しpresent遷移

Last updated at Posted at 2019-12-04

はじめに

普段、IOSのアプリ開発をしているゆーすけと言います。
これから備忘録も兼ねてQiitaの記事を投稿していこうと思います!
あまり投稿は慣れてないので多少見辛いかもしれませんが
よろしくお願いします。

経緯

現在新規アプリの開発に携わっているのですが、
アニメーション無しでViewControllerの遷移をする必要がありました。
今までアニメーション無しの遷移なんてなかなか使ってなかったので
直ぐには方法が思いつかなかったというのが経緯です。

実装

FirstViewController.swift
   let secondViewController = UIViewController()
   self.present(secondViewController, animated: false, completion: nil)

ポイントはanimatedをfalseにすることです。
falseにすることでアニメーション無しで遷移できます。

普段、何も意識せずanimatedはtrueにしていたので、
それぞれの引数がどんな役割をしているのか、もっと意識して実装しないとなと
改めて感じました。。

2
2
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
2
2