inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

chungchung님의 게시글

chungchung chungchung

@chungchung2096

수강평 작성수
6
평균평점
5.0

게시글 2

질문&답변

FirstItem & SecondItem 순서에 관해 질문이있습니다.

IB 왼쪽의 Constraints 리스트에서 FirstItem = multiplier * SecondItem + constant 로 됩니다. 예를 들어 multiplier를 0.7로 주고, constant를 30으로 주면, 그에 맞게 x 또는 y 의 값이 계산되는 식으로 보입니다. (FirstItem의 y 값) = 0.7 * (SecondItem의 y 값) + 30 예를 들어, FirstItem이 label의 centerY, SecondItem이 루트view의 centerY 라고 할 때, label의 centerY = 0.7 * 448 + 30 인 값으로 centerY가 정해진다고 보면 될 것 같습니다. * 448은 iPhone11일 때 centerY 값(=view의 전체높이 / 2) 입니다. 그래서 First 와 Second를 reverse하면 multiplier 입력했던 것이 역수로, constant 입력했던 것이 - 로 변합니다.

좋아요수
0
댓글수
1
조회수
217

질문&답변

Chat_6 키보드 올라갈때 테이블 스크롤 이동 이슈

keyboardWillShow에서 animation이 끝난 시점에 lastIndexPath로 테이블뷰를 스크롤 해주는 방법이 있을 것 같아요. animation의 완료와 상관없이 테이블뷰를 스크롤하면, 아직 테이블뷰의 bottom이 저 아래에 있어서 제대로 안되는 것 같네요. @objc private func keyboardWillShow(noti: Notification) { let notiInfo = noti.userInfo! let keyboardFrame = notiInfo[UIResponder.keyboardFrameEndUserInfoKey] as! CGRect let height = keyboardFrame.size.height - self.view.safeAreaInsets.bottom let animationDuration = notiInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as! Double inputTextViewBottomMargin.constant = height UIView.animate(withDuration: animationDuration) { self.view.layoutIfNeeded() } completion: { [unowned self] isCompleted in if isCompleted { if !self.chatDatas.isEmpty { let lastIndexPath = IndexPath.init(row: self.chatDatas.count - 1, section: 0) self.chatTableView.scrollToRow(at: lastIndexPath, at: .bottom, animated: true) } } } }

좋아요수
0
댓글수
1
조회수
291