Jelajahi Sumber

emptyremindview 内存泄漏修复

huzhiqiang 3 tahun lalu
induk
melakukan
d2121f7784

+ 1 - 1
BFFramework/Classes/Base/Controller/PQBaseViewController.swift

@@ -158,7 +158,7 @@ open class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate {
 
     deinit {
         PQNotification.removeObserver(self)
-        BFLog(message: "\(String(describing: type(of: self)))被销毁")
+        BFLog(1, message: "\(String(describing: type(of: self)))被销毁 release")
     }
 
     override open var preferredStatusBarStyle: UIStatusBarStyle {

+ 10 - 10
BFFramework/Classes/Base/Controller/PQPhotoAlbumController.swift

@@ -42,28 +42,28 @@ open class PQPhotoAlbumController: PQBaseViewController {
     }()
 
     lazy  public var emptyRemindView: PQEmptyRemindView = {
-        let emptyRemindView = PQEmptyRemindView(frame: albaumCollectionView.bounds)
-        emptyRemindView.isHidden = true
+        let remindView = PQEmptyRemindView(frame: albaumCollectionView.bounds)
+        remindView.isHidden = true
         albaumCollectionView.addSubview(emptyRemindView)
-        emptyRemindView.backgroundColor = PQBFConfig.shared.styleBackGroundColor
-        emptyRemindView.fullRefreshBloc = { [weak self] _, _ in
-            if emptyRemindView.refreshBtn.currentTitle == "授予权限" {
+        remindView.backgroundColor = PQBFConfig.shared.styleBackGroundColor
+        remindView.fullRefreshBloc = { [weak self] _, _ in
+            if self?.emptyRemindView.refreshBtn.currentTitle == "授予权限" {
                 openAppSetting()
-            } else if emptyRemindView.refreshBtn.currentTitle == "刷新" {
+            } else if self?.emptyRemindView.refreshBtn.currentTitle == "刷新" {
                 self?.albaumsData.removeAll()
                 self?.loadPhotoData()
             }
         }
-        emptyRemindView.remindLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
-        emptyRemindView.refreshBtn.setTitle("授予权限", for: .normal)
+        remindView.remindLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
+        remindView.refreshBtn.setTitle("授予权限", for: .normal)
         let anthorEmptyData = PQEmptyModel()
         anthorEmptyData.title = "挑选相册素材"
         anthorEmptyData.summary = "要挑选相册素材,请先授予相册使用权限"
         anthorEmptyData.emptyImage = "icon_authorError"
         anthorEmptyData.isRefreshHidden = false
         anthorEmptyData.refreshBgColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
-        emptyRemindView.emptyData = anthorEmptyData
-        return emptyRemindView
+        remindView.emptyData = anthorEmptyData
+        return remindView
     }()
 
     lazy  public var albaumView: UIView = {

+ 10 - 10
BFFramework/Classes/Base/Controller/PQPhotoMaterialController.swift

@@ -97,22 +97,22 @@ class PQPhotoMaterialController: PQBaseViewController {
     }()
 
     lazy var emptyRemindView: PQEmptyRemindView = {
-        let emptyRemindView = PQEmptyRemindView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height))
-        emptyRemindView.isHidden = true
-        photoCollectionView.addSubview(emptyRemindView)
-        emptyRemindView.backgroundColor = PQBFConfig.shared.styleBackGroundColor
-        emptyRemindView.fullRefreshBloc = { [weak self] _, _ in
-            if emptyRemindView.refreshBtn.currentTitle == "授予权限" {
+        let remindView = PQEmptyRemindView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height))
+        remindView.isHidden = true
+        photoCollectionView.addSubview(remindView)
+        remindView.backgroundColor = PQBFConfig.shared.styleBackGroundColor
+        remindView.fullRefreshBloc = { [weak self] _, _ in
+            if self?.emptyRemindView.refreshBtn.currentTitle == "授予权限" {
                 openAppSetting()
-            } else if emptyRemindView.refreshBtn.currentAttributedTitle == NSMutableAttributedString(string: "刷新") {
+            } else if self?.emptyRemindView.refreshBtn.currentAttributedTitle == NSMutableAttributedString(string: "刷新") {
                 self?.loadLocalData()
             } else if self?.emptyRefreshHandle != nil {
                 self?.emptyRefreshHandle!(self?.msgType ?? .all)
             }
         }
-        emptyRemindView.remindLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
-        emptyRemindView.refreshBtn.addCorner(corner: 4)
-        return emptyRemindView
+        remindView.remindLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
+        remindView.refreshBtn.addCorner(corner: 4)
+        return remindView
     }()
 
     override func viewDidLoad() {

+ 7 - 7
BFFramework/Classes/selectImage/PQUploadController.swift

@@ -157,17 +157,17 @@ class PQUploadController: PQBaseViewController {
     }()
 
     lazy var emptyRemindView: PQEmptyRemindView = {
-        let emptyRemindView = PQEmptyRemindView(frame: CGRect(x: 0, y: cDevice_iPhoneNavBarAndStatusBarHei, width: cScreenWidth, height: cScreenHeigth - cDevice_iPhoneNavBarAndStatusBarHei))
-        emptyRemindView.isHidden = true
-        emptyRemindView.emptyData = anthorEmptyData
-        view.addSubview(emptyRemindView)
-        emptyRemindView.fullRefreshBloc = { [weak self] _, _ in
+        let remindView = PQEmptyRemindView(frame: CGRect(x: 0, y: cDevice_iPhoneNavBarAndStatusBarHei, width: cScreenWidth, height: cScreenHeigth - cDevice_iPhoneNavBarAndStatusBarHei))
+        remindView.isHidden = true
+        remindView.emptyData = anthorEmptyData
+        view.addSubview(remindView)
+        remindView.fullRefreshBloc = { [weak self] _, _ in
             self?.isJumpToAuthorization = true
-            if emptyRemindView.refreshBtn.currentTitle == "授予权限" {
+            if self?.emptyRemindView.refreshBtn.currentTitle == "授予权限" {
                 openAppSetting()
             }
         }
-        return emptyRemindView
+        return remindView
     }()
 
     lazy var collectionView: UICollectionView = {