LoginSignup
7
6

More than 5 years have passed since last update.

背景を透過して遷移元画面を見せる方法

Last updated at Posted at 2017-08-12

どーゆーヤツ?

こーゆーヤツです
Image uploaded from iOS.jpg

環境

・Xcode -> 8.3.3
・Swift -> 3.1

swiftファイル側

遷移元のクラスファイルに以下を記述

ViewController.swift
// 遷移先のクラスを生成し、遷移処理を書く(modal処理です)
let hogeViewController = HogeViewController()
present(hogeViewController, animated: true, completion: nil)

以上

Storyboard側

2箇所イジる

1.呼び出したい画面を選択し、UtilityAreaのAttributesInspectorを選んで
hoge1.png
に変える

2.呼び出したい画面のViewを選択し、UtilityAreaのAttributesInspectorを選んで
hoge2.png
に変える。ここは何してるかというと

hoge3.png
こうやって黒色に対し、透明度をいじってます。ここで透過してます。

まとめ

この手の記事って昔っからありますが、複数人で作業することを考慮したり(Storyboardの競合)、Storyboardの扱いづらさだったり、そもそもStoryboardを毛嫌いしてたりでコーディングだけに絞ったものが多いですよね。
あえてStroyboardで書けるよってのを改めて書いておきたかった次第です。
(もちろん検索すれば同じ記事はQiitaでもあるかとは思いますが、個人的な備忘も兼ねて)

以上です。

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