소스 검색

scroll to top on cancel search

nayooti 5 년 전
부모
커밋
eafe2e2871
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      deltachat-ios/Controller/ChatListController.swift

+ 8 - 0
deltachat-ios/Controller/ChatListController.swift

@@ -356,5 +356,13 @@ extension ChatListController: UISearchBarDelegate {
 
     func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
         viewModel.endSearch()
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
+           self.tableView.scrollToTop()
+        }
+    }
+
+    func searchBar(_ searchBar: UISearchBar, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
+        tableView.scrollToTop()
+        return true
     }
 }