일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- kotlin
- Xcode
- Chrats
- PyQt
- 그래프
- UITableView
- TableView
- graph
- UIKit
- 어플리케이션
- androidstudio
- ios
- button
- 개발자
- cocoapods
- 라이브러리
- 개발
- ui
- UIButton
- PyQt5
- Storyboard
- charts
- Android
- Apple
- Chart
- modal
- library
- Python
- alamofire
- Swift
Archives
- Today
- Total
Jiwift
[iOS/Swift] safeAreaInsets 상단, 하단 영역 구하기 본문
반응형
safearea의 상단, 하단 insets을 구하는 코드
let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene
let topPadding = scene?.windows.first?.safeAreaInsets.top ?? .zero
let bottomPadding = scene?.windows.first?.safeAreaInsets.bottom ?? .zero
UIApplication을 통해서 top과 bottom의 safeAreaInsets을 구할 수 있다.
connectedScenes는 iOS 13부터 사용할 수 있다.
How can I get the safeAreaInsets i… | Apple Developer Forums
How can I get the safeAreaInsets i… | Apple Developer Forums
In the past, I use UIApplication.shared.windows.first?.safeAreaInsets.bottom to get the bottom safe area, but in iOS 15, there is an warning shows that windows has been deprecated. My project is written in SwiftUI, so is there a way to get the global safeA
forums.developer.apple.com
반응형
'iOS Dev > iOS' 카테고리의 다른 글
[iOS/Swift] Privacy Manifest 최종 정리 (0) | 2024.05.08 |
---|---|
[iOS/Swift] 앱에서 정적 라이브러리(.a)를 사용하는 분들이 있나요?? (0) | 2024.04.26 |
[iOS/Swift] 프로젝트 폴더 구조 구성 (0) | 2024.04.21 |
[iOS/Swift] MapKit 화면 이동 감지 Delegate (0) | 2024.04.15 |
[iOS/Swift] MapKit 추가하기 (0) | 2024.04.14 |