Skip to content

Commit 61a80a4

Browse files
committed
简化过渡动画效果
1 parent f1e7dd1 commit 61a80a4

2 files changed

Lines changed: 10 additions & 43 deletions

File tree

Controller/MessageListViewController.swift

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -376,49 +376,16 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
376376
return
377377
}
378378

379-
DispatchQueue.main.async { [weak self] in
380-
guard let self else { return }
381-
382-
let visibleCells = self.prepareInitialVisibleCellsAnimation()
383-
UIView.animate(
384-
withDuration: 0.26,
385-
delay: 0,
386-
options: [.beginFromCurrentState, .curveEaseOut]
387-
) {
388-
self.initialLoadingView.alpha = 0
389-
} completion: { _ in
390-
self.initialLoadingView.removeFromSuperview()
391-
}
392-
393-
for (index, cell) in visibleCells.enumerated() {
394-
UIView.animate(
395-
withDuration: 0.5,
396-
delay: 0.06 + Double(index) * 0.035,
397-
usingSpringWithDamping: 0.9,
398-
initialSpringVelocity: 0.12,
399-
options: [.beginFromCurrentState, .curveEaseOut]
400-
) {
401-
cell.alpha = 1
402-
cell.transform = .identity
403-
}
404-
}
379+
UIView.animate(
380+
withDuration: 0.26,
381+
delay: 0,
382+
options: [.beginFromCurrentState, .curveEaseOut]
383+
) {
384+
self.initialLoadingView.alpha = 0
385+
} completion: { _ in
386+
self.initialLoadingView.removeFromSuperview()
405387
}
406388
}
407-
408-
private func prepareInitialVisibleCellsAnimation() -> [UITableViewCell] {
409-
tableView.layoutIfNeeded()
410-
411-
let visibleCells = tableView.indexPathsForVisibleRows?
412-
.sorted()
413-
.compactMap { tableView.cellForRow(at: $0) } ?? []
414-
415-
for cell in visibleCells {
416-
cell.alpha = 0
417-
cell.transform = CGAffineTransform(translationX: 0, y: 10)
418-
}
419-
420-
return visibleCells
421-
}
422389
}
423390

424391
extension MessageListViewController: UITableViewDelegate {

View/MessageList/MessageListSkeletonView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ final class MessageListSkeletonView: UIView {
3535
static let cardSpacing: CGFloat = 10
3636
static let topInset: CGFloat = {
3737
if #available(iOS 26.0, *) {
38-
return 10 + 20
38+
return 20
3939
}
40-
return 10
40+
return 0
4141
}()
4242
static let bottomInset: CGFloat = 24
4343
}

0 commit comments

Comments
 (0)