8
4

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 3 years have passed since last update.

【Swift】SafeAreaの高さを取得する

Last updated at Posted at 2021-01-19

SafeAreaの高さを取得したかったので調べました。

##SafeAreaの高さ

//上部のSafeArea
let safeAreaTop = self.view.safeAreaInsets.top
print(safeAreaTop)

//下部のSafeArea
let safeAreaBottom = self.view.safeAreaInsets.bottom
print(safeAreaBottom)

##ちなみに
viewDidLoadの時点ではSafeAreaの値は取得出来なかったのでviewWillLayoutSubviewsの時に取得するのが良さそうです。

8
4
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
8
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?