program story

'automaticallyAdjustsScrollViewInsets'는 iOS 11.0에서 더 이상 사용되지 않습니다.

inputbox 2021. 1. 5. 08:04
반응형

'automaticallyAdjustsScrollViewInsets'는 iOS 11.0에서 더 이상 사용되지 않습니다.


방금 iOS 11까지 컴파일하기 시작했고 Apple이 이제 속성을 선언했음을 알았습니다.

var automaticallyAdjustsScrollViewInsets: Bool { get set }

지원 중단됨 :

https://developer.apple.com/documentation/uikit/uiviewcontroller/1621372-automaticallyadjustsscrollviewin

여기에 이미지 설명 입력

iOS 11에서이 경고를 수정하는 다른 속성이 있습니까?

기본값이 true로 유지됩니까? 아니면 나중에 어떻게 처리됩니까?


이제이 속성의 기본값은 true입니다. 이를 설정해야하는 경우 viewController를 호스팅하고 해당 속성 contentInsetAdjustmentBehavior를 설정하는 scrollview에서 설정해야합니다. 다음은 예입니다.

scrollView.contentInsetAdjustmentBehavior = .automatic

이 코드가 도움이 될 수 있습니다.

if #available(iOS 11.0, *) {
    scrollView.contentInsetAdjustmentBehavior = .never
} else {
    automaticallyAdjustsScrollViewInsets = false
}

Interface Builder에서 설정할 수도 있습니다. tableView 또는 collectionView를 선택한 다음 크기 검사기의 드롭 다운에서 선택하고 'Content Insets Adjustment Behavior'를 선택하지 마십시오.

크기 검사기

참조 URL : https://stackoverflow.com/questions/44390971/automaticallyadjustsscrollviewinsets-was-deprecated-in-ios-11-0

반응형