Переглянути джерело

add comments, free memory when leaving gallery

B. Petersen 2 роки тому
батько
коміт
1ebf291963
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      deltachat-ios/Controller/GalleryViewController.swift

+ 7 - 0
deltachat-ios/Controller/GalleryViewController.swift

@@ -94,11 +94,18 @@ class GalleryViewController: UIViewController {
     }
 
     override func viewWillAppear(_ animated: Bool) {
+        // if would be better to reload on the corresponding events, see #1846
         galleryItemCache = [:]
         grid.reloadData()
+
         setupContextMenuIfNeeded()
     }
 
+    override func viewDidDisappear(_ animated: Bool) {
+        // user leaves view and may not come back soon: clearing cache may free a significant amount of memory
+        galleryItemCache = [:]
+    }
+
     override func viewWillLayoutSubviews() {
         super.viewWillLayoutSubviews()
         self.reloadCollectionViewLayout()