Skip to content

Commit bab4b1f

Browse files
committed
fix: cannot remove self.subviews in updateConstraints
1 parent 313c17b commit bab4b1f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Easydict/objc/ViewController/View/Titlebar/EZTitlebar.m

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,23 @@ - (void)setup {
5959
[defaultCenter addObserver:self selector:@selector(updateConstraints) name:NSNotification.languagePreferenceChanged object:nil];
6060
}
6161

62+
//- (void)update
63+
6264
- (void)updateConstraints {
65+
/**
66+
Fix appcenter issue, seems cannot remove self.subviews 🤔
67+
68+
-[EZTitlebar updateConstraints]
69+
EZTitlebar.m, line 64
70+
SIGABRT: *** Collection <__NSArrayM: 0x6000036e45d0> was mutated while being enumerated.
71+
*/
72+
6373
// Remove and dealloc all views to refresh UI.
64-
for (NSView *subview in self.subviews) {
65-
[subview removeFromSuperview];
66-
}
74+
75+
[_pinButton removeFromSuperview];
76+
[_stackView removeFromSuperview];
6777
_stackView = nil;
78+
_quickActionButton = nil;
6879

6980
[self addSubview:self.pinButton];
7081
[self updatePinButton];

0 commit comments

Comments
 (0)