Programing
[iOS] 상단 Safety Area 영역
npre
2022. 2. 18. 14:10
반응형
- (CGFloat)safetyAreaHeight {
if (@available(iOS 11.0, *)) {
UIEdgeInsets edgeInsets = [UIApplication sharedApplication].windows[0].safeAreaInsets;
if (edgeInsets.top != 0 && edgeInsets.bottom != 0) {
CGFloat height = [UIApplication sharedApplication].windows.firstObject.safeAreaInsets.top;
return height;
}else{
return 20;
}
} else {
return 20;
}
return 20;
}
NON-Notch - 20px
pro가 45
mini가 50으로 영역이 더 큼. 참고