Philographer

ScrollView + presentViewController Bug

  • Bug: 스크롤뷰에 autolayout을 적용하였을때,presentViewController를 이용해 새 뷰를 띄우고 나서 dismissviewcontroller를 이용해 닫았을때 아래 이미지처럼 스크롤뷰가 내려감.


  • 원인

    This method sets the presentedViewController property to the specified view controller, resizes that view controller’s view and then adds the view to the view hierarchy. The view is animated onscreen according to the transition style specified in the modalTransitionStyle property of the presented view controller.

    짧게 요약하자면 presentViewController를 쓰면 viewcontroller의 사이즈를 resize하기 때문.


  • 해결책: 한줄이면 된다간단하다.
//한 줄만 적용하면 끝
self.automaticallyAdjustsScrollViewInsets = false

참조: http://stackoverflow.com/questions/17404682/uiscrollviews-origin-changes-after-popping-back-to-the-uiviewcontroller


'IOS > Layout' 카테고리의 다른 글

@IBInspectable, @IBDesignable, Auto Font Size  (0) 2016.07.02
IOS, iPhone 사이즈  (0) 2016.06.30
no index path for table cell being reused  (2) 2016.06.27
Custom Modal 만들기 (alpha tip)  (0) 2016.06.26
ScrollView Auto Layout  (0) 2016.06.26
댓글 로드 중…

트랙백을 확인할 수 있습니다

URL을 배껴둬서 트랙백을 보낼 수 있습니다