-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EditPage 자잘한 버그수정 (높이 이슈, 페이지 추가시 스크롤) #146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셔씁니다 UX가 훨씬 좋아졌네요 〰️
@@ -22,7 +22,6 @@ final class EditPageCell: UITableViewCell { | |||
textView.autocorrectionType = .no | |||
textView.autocapitalizationType = .none | |||
textView.spellCheckingType = .no | |||
textView.isScrollEnabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
문제의 '그' 코드,, 고생하셨습니다
근데 혹시 왜 False 했을 때 개선되는지 알게 되셨나요 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하하 아무리 찾아도 안나와요...ㅠㅠ
// 갖은 경우의 수 별로 cachedViewProvider를 nil로 변경합니다. | ||
// 왜냐하면, 줄바꿈을 추가했을 때, 캐시된 View가 업데이트 되어야 하기 때문입니다. | ||
if range.location > 0 | ||
&& viewText[viewText.index(startIndex, offsetBy: range.location-1)] == "\n" | ||
&& text.count == 1, | ||
let attachment = (attachmentAt(range.location) ?? attachmentAt(min(range.location+1, viewText.count-1))) { | ||
attachment.cachedViewProvider = nil | ||
} | ||
if text == "\n" { // 줄바꿈을 추가할때 | ||
if let attachment = attachmentAt(range.location) { // Attachment 앞에 줄바꿈을 추가할때 | ||
attachment.cachedViewProvider = nil | ||
} | ||
else if let attachment = attachmentAt(range.location+1) { // Attachment 1칸 앞에 줄바꿈을 추가할때 | ||
attachment.cachedViewProvider = nil | ||
} | ||
} | ||
if text.isEmpty { // 지우기할때 | ||
if let attachment = attachmentAt(range.location+1) { // Attachment 1칸 앞에 줄바꿈을 추가할때 | ||
if range.location < 1 { // 첫째 줄에 도달하기 전에 지우기할때 | ||
attachment.cachedViewProvider = nil | ||
return true | ||
} | ||
textView.selectedRange = NSRange(location: range.location, length: 0) | ||
return false | ||
} | ||
else if let attachment = attachmentAt(range.location+2), // Attachment 2칸 앞에 줄바꿈을 추가할때 | ||
textView.text[textView.text.index(textView.text.startIndex, offsetBy: range.location+1)] == "\n" { | ||
attachment.cachedViewProvider = nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그럼 이 코드도 textView.isScrollEnabled = false 때문이었나요 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞습니다... 수동 최적화의 흔적...
extension MediaType { | ||
var height: Double { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옷 혹시 파일 분리하신 이유가 뭐죵 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presentaion에서만 사용하는 코드가 Domain에 생기면 약간 다른곳들도 접근가능하게 되는 것같아서 프레젠테이션 모듈 내에서만 쓰도록 extension으로 뺐습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아아 확인했습니다 좋아요 ~!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
역시..역시..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그..코드가..결국 소멸됐군요.. ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
결국... 마참내...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
대 정 현🛠️
#️⃣ 연관된 이슈
⏰ 작업 시간
📝 작업 내용
📸 스크린샷
2024-12-05.12.55.11.mov
📒 리뷰 노트
버벅임 이슈를 개선하기 위해 좀 많은 삽집질을 했습니다...
그런데 보니까 textView.isScrollEnabled가 false로 되어있으면
타자 한번당 attachmentViewProvider가 여러번 호출 되더라구요...
true로 바꾸니까 타자 한번당 한번호출되어서 뷰가 글리치 거리는 게 현저히 줄었습니다.
-> 그리고 이것을 위해 원래 cachedViewProvider를 써서 엣지케이스별로(뷰가 망가질떄마다) 직접 cache를 지워주었어야 했습니다.
그런데 이제 위에처럼 하니까 편--안해져서 관련 코드를 다 날렸습니다.
+) 지금 Media관련 View를 옮길경우(drag-drop) textView의 shouldEdit이 호출되지 않는 문제가 있습니다.
그래서 여러번 옮기다보면 결국 뷰의 크기를 넘어가게 되는데... 이경우 스크롤을 enabled해놔서 스크롤이 됩니다... (그나마 삭제만 기능하고 더이상 추가는 안됨)