UIScrollView와 UINavigationBar가 어긋났을 때의 대응
2658 단어 StoryboardObjective-C아이폰
현상
UINavigationBar가있는 ViewController에 ScrollView를 전체 화면으로 놓고,
UI 컴포넌트를 두었습니다.
그러나 StoryBoad의 표시 위치와 빌드했을 때의 iPhone의 화면이 아무래도 어긋난다.
그 해결 방법을 조사했습니다.
UI 구성 요소의 계층 구조는
(20150719일 추가)
AutoLayout의 설정은 Visual Format Language로 나타내면
H:|-(-16)-[ScrollView]-(-16)|
V:|-[ScrollView]-|
|-[View(600)]-|
H:|-8-[Label]|
V:|-153-[Label]|

Storyboad에서 내비게이션 바로 아래에 라벨 "IB와 표시 위치가 다르다"를 배치했습니다.
앱을 실행할 때 표시

실행했을 때의 레이아웃은 라벨이 네비게이션의 꽤 아래에 왔습니다.
(네비게이션과 같은 거리 떨어져??)
해결 방법
ViewController의 AttributesInspector에서
Layout > Adust Scroll View Insets
을 끄면 IB에서의 표시와 동일합니다.

Adust Scroll View Insets를 끄고 앱 실행 표시

메커니즘
Adjust Scroll View Insets와 Under Top Bars를 모두 확인한 경우
contentInsets.top이 조정되었습니다.
UIScroll은 내비게이션 바 아래에서 시작하는 것 같습니다.
그래서 Adjust Scroll View Insets를 끄는 것이 좋습니다.
참고
역시 너희들의 iOS7 대응은 잘못되어 있다(해설편)
ぃ tp // 이 m / y 지금 / ms / 254c7하면 b7864678246
Reference
이 문제에 관하여(UIScrollView와 UINavigationBar가 어긋났을 때의 대응), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/SatoTakeshiX/items/26415071db48ee53015a텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)