LoginSignup
0
1

More than 1 year has passed since last update.

【Swift】UIWindowのmakeKeyAndVisibleとisHiddenの違いについて

Last updated at Posted at 2021-05-03

makeKeyAndVisibleとは

func makeKeyAndVisible()

This is a convenience method to show the current window and position it in front of all other windows at the same level or lower. If you only want to show the window, change its isHidden property to false.

現在のウィンドウを表示させ、同じレベルかそれ以下の他のすべてのウィンドウの前に位置させるメソッド。ウィンドウを表示するだけの場合は、isHiddenプロパティをfalseに変更するとされています。この場合はwindowとして表示させるのみで、位置に関しては関係しません。

isHiddenとは

var isHidden: Bool { get set }

このプロパティの値をtrueに設定すると、レシーバーが非表示になり、falseに設定すると、レシーバーが表示されます。既定値は false です。ウィンドウの対応するビューを非表示にすると、そのビューの次の有効なキービューが新しい最初のレシーバーになります。

これらを確かめてみたのが次です。画面が表示された後に、Dispatch.main.asyncメソッドで3秒後に戻しています。KeyWindowに表示されているのは、ボタンを押した直後の画面です。

keyWindowとは

var keyWindow: UIWindow? { get }

This property holds the UIWindow object in the windows array that is most recently sent the makeKeyAndVisible() message.

このプロパティは、windows配列の中で、直近にmakeKeyAndVisible()メッセージが送られたUIWindowオブジェクトを保持します。

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