Просмотр исходного кода

fix: 修复部分UI界面崩溃

陈文艺 8 часов назад
Родитель
Сommit
54bd6fc88b

+ 1 - 1
Lanu/Common/Views/ImagePreview/LNImagePreviewController.swift

@@ -38,7 +38,7 @@ class LNImagePreviewController: LNViewController {
         curIndex = targetIndex
         
         collectionView?.reloadData()
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             collectionView?.scrollToItem(
                 at: .init(row: curIndex, section: 0),

+ 1 - 1
Lanu/Common/Views/Selection/LNHourRangePickerPanel.swift

@@ -188,7 +188,7 @@ extension LNHourRangePickerPanel {
             make.top.equalTo(pickerView.snp.bottom).offset(4)
         }
         
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             fromPicker.subviews.forEach {
                 if $0.subviews.isEmpty {

+ 1 - 1
Lanu/Common/Views/VideoPreview/LNVideoPreviewController.swift

@@ -38,7 +38,7 @@ class LNVideoPreviewController: LNViewController {
         curIndex = targetIndex
         
         collectionView?.reloadData()
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             collectionView?.scrollToItem(
                 at: .init(row: curIndex, section: 0),

+ 1 - 1
Lanu/Common/Voice/LNVoiceRecorder.swift

@@ -67,7 +67,7 @@ class LNVoiceRecorder {
         curState = .recording
         curTaskId = "\(curTime)"
         
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             notifyTaskStart()
         }

+ 3 - 3
Lanu/Views/Game/Category/LNGameCategoryListView.swift

@@ -40,7 +40,7 @@ class LNGameCategoryListView: UIView {
         self.categories = categories
         collectionView.reloadData()
         
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             fixBottomSpace()
         }
@@ -50,7 +50,7 @@ class LNGameCategoryListView: UIView {
         guard let index = categories.firstIndex(where: { $0.code == category.code }) else {
             return
         }
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             if let headerAttributes = collectionView.layoutAttributesForSupplementaryElement(
                 ofKind: UICollectionView.elementKindSectionHeader,
@@ -69,7 +69,7 @@ class LNGameCategoryListView: UIView {
         let width = (bounds.width - collectionViewLayout.minimumInteritemSpacing) / CGFloat(columns) - collectionViewLayout.minimumInteritemSpacing
         collectionViewLayout.itemSize = .init(width: width, height: 68)
         
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             fixBottomSpace()
         }

+ 1 - 1
Lanu/Views/Game/MateFilter/LNGameCategoryFilterPanel.swift

@@ -128,7 +128,7 @@ extension LNGameCategoryFilterPanel {
             }), for: .touchUpInside)
             
             if index == 0 {
-                runOnMain { [weak self, weak button] in
+                DispatchQueue.main.async { [weak self, weak button] in
                     guard let self, let button else { return }
                     handleClickTab(view: button, typeItem: title)
                 }

+ 1 - 1
Lanu/Views/Order/OrderQR/LNOrderGenerateQRCodePanel.swift

@@ -33,7 +33,7 @@ class LNOrderGenerateQRCodePanel: LNPopupView {
         
         setupViews()
         
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             tabView.curType = .normal
             curSkill = myUserInfo.skills.first

+ 1 - 1
Lanu/Views/Room/Gift/LNRoomGiftBottomView.swift

@@ -56,7 +56,7 @@ class LNRoomGiftBottomView: UIView {
         setupViews()
         LNEventDeliver.addObserver(self)
         
-        runOnMain { [weak self] in
+        DispatchQueue.main.async { [weak self] in
             guard let self else { return }
             curCount = 1
             enable = false