LoginSignup
3
3

More than 5 years have passed since last update.

Swift学習メモ vol.2

Last updated at Posted at 2014-09-14

StoryBoardに慣れる。

Step1 ViewControllerを並べる

Screen Shot 2014-09-14 at 3.19.39 PM.png

Step2 UIViewControllerファイルを新しく作成する

Screen Shot 2014-09-14 at 3.22.18 PM.png

クラス名はViewController2としました。

Step3 Step1で作成したViewControllerのカスタムクラスをViewController2とする。

Screen Shot 2014-09-14 at 3.26.57 PM.png

Step4 それぞれのViewに適当にボタンとラベルを配置する

Screen Shot 2014-09-14 at 3.46.51 PM.png

Step5 View1のボタンからView2に向けてドラッグする

Screen Shot 2014-09-14 at 3.48.51 PM.png

ドラッグすると、様々なものが現れるので、Showを選択します。

Screen Shot 2014-09-14 at 3.48.55 PM.png

選択後は下の画像のようになります。

Screen Shot 2014-09-14 at 3.49.05 PM.png

途中経過

gif02.gif

View1からView2には遷移しますが、View2からView1に遷移しません。

Step5 View2からView1を戻るようにする

Screen Shot 2014-09-14 at 4.07.02 PM (2).png

Screen Shot 2014-09-14 at 4.07.11 PM.png

ViewController2.swift
@IBAction func Dismiss(sender: AnyObject) {
        self.view.window?.rootViewController?.dismissViewControllerAnimated(true, completion: nil)
}

今回の成果物

gif03.gif

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