zombie45
zombie's dev story
zombie45

공지사항

  • 분류 전체보기
    • iPhone
    • Study

인기 글

최근 댓글

최근 글

티스토리

반응형

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록
  • 글쓰기
전체 방문자
오늘
어제

태그

  • caching
  • Animtaion
  • 안드로이드
  • FocusScope
  • cspell
  • nextFocus
  • intl
  • 자동배포
  • 티스토리챌린지
  • Flutter
  • 카카오 로그인
  • android_key_hash
  • 큰파일
  • flutter_localizations
  • actions
  • cocoapods-binary-cache
  • flutter l10n helper
  • Box2d cocos2dx cocos2d-x
  • Nodejs node express expressjs
  • jks
  • 큰폴더
  • TextInputAction
  • l10nization
  • appDelegate
  • textformfield
  • UIViewController
  • cache
  • code spell checker
  • 오블완
  • CI/CD
hELLO · Designed By 정상우.
zombie45

zombie's dev story

iPhone

Safe area / layout by code for iPhone X, XS, XR, XS Max

2020. 6. 10. 11:15

simple fix

let SAFE_TOP: CGFloat = UIScreen.main.applicationFrame.height >= 792 ? 22.0 : 0
let SAFE_BOTTOM: CGFloat =UIScreen.main.applicationFrame.height >= 792 ? 34.0 : 0

for ipad use below

struct Constraints {
    static var STATUS_HEIGHT: CGFloat {
        if #available(iOS 11.0, *) {
            let window: UIWindow = UIApplication.shared.windows[0]
            let safeFrame = window.safeAreaLayoutGuide.layoutFrame
            return safeFrame.minY
        } else {
            return 20
        }
    }
    static var SAFE_BOTTOM: CGFloat {
        if #available(iOS 11.0, *) {
            let window: UIWindow = UIApplication.shared.windows[0]
            let safeFrame = window.safeAreaLayoutGuide.layoutFrame
            return window.frame.maxY - safeFrame.maxY
        } else {
            return 0
        }
    }
}
반응형
저작자표시 (새창열림)

'iPhone' 카테고리의 다른 글

Swift Lint yml  (0) 2020.07.26
AWS Simple Notification Service p12  (0) 2020.06.10
Underline text / title in UIButton  (0) 2020.06.10
rbenv install stuck at installing openssl  (0) 2020.06.09
iOS10 firebase crashlytics showing NSInternalInconsistencyException  (0) 2020.06.09
    'iPhone' 카테고리의 다른 글
    • Swift Lint yml
    • AWS Simple Notification Service p12
    • Underline text / title in UIButton
    • rbenv install stuck at installing openssl
    zombie45
    zombie45
    잡다한 개발

    티스토리툴바