[FIX/#100] 스크롤뷰 컨텐츠 센터링 + 줌 문제 해결 #102
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤔 배경
📃 작업 내역
✅ 리뷰 노트
1. image가 있기 전에 content 영역을 잡으려 함
CanvasScrollView의 내부 ContentView의 위치를 잡기 위해서는 아래 두개의 메서드를 사용합니다. 그런데 두 메서드 전부 self.imageView.image에 의존을 하고 있습니다.하지만
imageView의 image는updateFrameImage(to: )메서드가 bind로 인해 호출되는 시점에 들어오고 있다보니 image가 없는 상황에서 영역을 설정해주려 하니 생긴 문제였습니다.이젠 깔쌈하게 해결 했습니다 👍
CanvasScrollView.swift
2. 코드 호출 순서
zoomScale을 세팅해주는 메서드를 다른 곳으로 옮겨서 호출하거나, Cycle이나 Render 타이밍을 더욱 뒤로 하는 별 짓을 다 해봤는데 여전히ZoomScale을 생성 시점 이후 특정 액션(버튼, Scrolling, ...)을 통해서 계속 잡아줘야지만 잡히는 문제가 있었습니다.메서드 내부에서 코드 순서의 문제인가 싶어 살짝 바꿔주니까 갑분 정상작동 ㄹㅇㅋㅋ
CanvasScrollView.swift
calculatedZoomScale을 할당해주는 순서에 따라 결과가 달라짐zoomScale이 정해지지 않은 상황에서zoomScale을 할당해주다보니 발생한것으로 보임🎨 스크린샷
🚀 테스트 방법