7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Swift3 Storyboardでポップアップビューを実装

Last updated at Posted at 2017-03-09

こちらの記事をSwift3に書き換えました。
http://qiita.com/dondoko-susumu/items/7b48413f63a771484fbe
Storyboardを使っているのでコードの書き換え部分は数行しかありません。

ModalViewController.swift(Swift3)

override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesEnded(touches, with: event)
        for touch: UITouch in touches {
            let tag = touch.view!.tag
            print(tag)
            if tag == 1 {
                dismiss(animated: true, completion: nil)
            }
        }
}

@IBAction func didTapClose(_ sender: AnyObject) {
       dismiss(animated: true, completion: nil)
}

ViewController.swift(Swift3)

@IBAction func didPressButton(_ sender: AnyObject) {
        performSegue(withIdentifier: "modal", sender: nil)
}
7
6
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
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?